Member Junction
    Preparing search index...

    Implemented by long-lived singletons (engines, services) that own background work — timers, intervals, subscriptions, sockets, child processes — so a coordinated shutdown can release them. Without this contract, SIGTERM/SIGINT handlers in the entry point have no way to reach into singleton state to clear timers, leaving the process unable to exit cleanly under load tests, CI runs, or graceful drains.

    Implementers register themselves with ShutdownRegistry.Instance.Register(this) (typically in their constructor) and provide a Shutdown() that releases the resource synchronously or returns a promise. The registry calls each implementer exactly once per ShutdownAll() invocation.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _contextUser: UserInfo

    Accessors

    • get IsStopped(): boolean

      Whether Stop() has been invoked. Once stopped, no further ProcessTasks iterations are scheduled and AddTask is rejected.

      Returns boolean

    • get QueueSize(): number

      Current number of tasks retained in the in-memory queue (pending + in-progress). Completed/failed tasks are removed once terminal, so this does not grow unbounded.

      Returns number

    • get ShutdownName(): string

      IShutdownable identity, surfaced in shutdown logs.

      Returns string

    Methods

    • Stops the recursive ProcessTasks loop, cancels any pending timer, and marks the queue as stopped so subsequent AddTask calls fail-fast. Idempotent. Implements IShutdownable.Shutdown so ShutdownRegistry.ShutdownAll() can drain queues during graceful shutdown.

      Returns void