Schedule jobs inside the caller's EF Core transaction

Ouverte
#59 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
18/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
csharp
Domaine
backend, databases

Piste de recherche

Design work first: read src/TickerNet.EntityFrameworkCore/DbContextFactory/TickerNetDbContext.cs to see how DbContextLease isolates the manager's writes, then draft the ADR in site/decisions/ proposing the API shape (passing a DbContext or DbTransaction) before any code. Done means the ADR is agreed, the public API is listed in the pull request, and tests cover commit-then-job-runs and rollback-then-nothing-scheduled. Comment on the issue to claim it and raise API questions in Discussions.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

.NET enhancement roadmap

What's missing

With EF Core, scheduling a job and saving your own data happen in separate transactions: the managers write through their own DbContext (DbContextLease in src/TickerNet.EntityFrameworkCore/DbContextFactory/TickerNetDbContext.cs). If the app's transaction rolls back, the job is still scheduled, and if the job write fails after the app commits, the work is lost.

Proposal

Let callers schedule time tickers (and add cron tickers) inside a transaction they already have, for example by passing their DbContext or the current DbTransaction, so the job is committed or rolled back together with their data. The scheduler must not see the job before the transaction commits; after commit it should pick the job up promptly.

Notes

  • EF Core only to start; document that other providers don't support it.
  • Covers the "outbox" use case. Needs an ADR for the API shape.
  • Tests: commit then the job runs; rollback then nothing is scheduled.

Part of the TickerQ comparison roadmap. Design it from this description only: never read or copy code, tests or docs from TickerQ 10.5.0 or later, which is under a commercial license (see CONTRIBUTING.md). If it adds or changes public API, add an ADR in site/decisions/ and list the API in the pull request. Comment here if you'd like to pick it up, and ask anything in Discussions.

Langage dominant
C#
Étoiles
0
Forks
2
Merge moyen
1 h 8 min
PR mergées (30 j)
24

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de TickerNet/TickerNet

Toutes les issues de TickerNet/TickerNet

Issues similaires

Plus d'issues C#

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.