You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Context]: add graceful shutdown via InFlightTaskTracker #27
Enable graceful shutdown (e.g. Pod drain in Kubernetes) by tracking in-flight context tasks outside the core, subscribing to lifecycle events, and waiting for drain before exit.
Constraint / Decision
Core does not track active tasks (No Global Lock, no global registry per 9.2/10.4). Counting live in an external component (InFlightTaskTracker) in the hosting/adapter layer.
Flow
Hosting (e.g. IHostedService) signals intention to stop.
InFlightTaskTracker counts tasks by subscribing to ContextLifecycleEvent (Started / Completed).
On stop signal, the host waits until the counter hits zero.
Core ContextManager keeps working undisturbed during drain.
Scope
InFlightTaskTracker (hosting side) counting inflight via lifecycle events.
Integration sample with IHostedService drain + CancellationToken.
Guarantee: no load on ContextManager; no blocking.
Unit tests: count increments/decrements; drain completes.
Design Expectations
Tracking lives outside Core (adapter/hosting).
Uses lifecycle events already emitted (K9/K10) — no core changes.
Activity