Wait for running jobs when the host shuts down

Offen
#48 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
42/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
csharp

Rechercherichtung

Start in src/TickerNet/Src/BackgroundServices/TickerNetSchedulerBackgroundService.cs at StopAsync: it freezes the scheduler and returns, so trace what state claimed-but-unstarted work is held in there. Then read the existing drain path in TickerNet.Worker and TickerNetWorkerOptions.ShutdownTimeout to mirror its shape, and add a drain timeout bounded by the host's ShutdownTimeout. Tests need two cases — a job finishing inside the timeout and one outlasting it (cancel token fired, unstarted work released rather than marked cancelled). Since options/config become public API, also add an ADR under site/decisions/ and list the API in the pull request.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

.NET enhancement roadmap

What happens

When the host stops, TickerNetSchedulerBackgroundService.StopAsync (src/TickerNet/Src/BackgroundServices/TickerNetSchedulerBackgroundService.cs) freezes the task scheduler and returns. Jobs that are running are cut off when the process exits, and their rows stay InProgress (see #47).

Expected

  • On shutdown, stop taking new work, then wait for running jobs up to a configurable drain timeout (bounded by the host's ShutdownTimeout).
  • Jobs that finish in time are recorded as usual.
  • Jobs still running when the timeout ends get their cancellation token cancelled. Work that was claimed but not started is released so another node can run it, instead of being marked cancelled.

Notes

  • TickerNet.Worker already drains on shutdown (ShutdownTimeout in TickerNetWorkerOptions); the scheduler side should behave the same way.
  • Add a test with a job that takes longer than the drain timeout and one that doesn't.

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.

Vorherrschende Sprache
C#
Sterne
0
Forks
2
Ø Merge
1 Std. 8 Min.
Gemergte PRs (30 T.)
24

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TickerNet/TickerNet

Alle Issues in TickerNet/TickerNet

Ähnliche Issues

Weitere Issues zu C#

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.