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.

    interface IShutdownable {
        ShutdownName?: string;
        Shutdown(): void | Promise<void>;
    }

    Implemented by

    Index

    Properties

    Methods

    Properties

    ShutdownName?: string

    Optional human-readable identifier surfaced in shutdown logs and used for de-duplication when Register is called repeatedly with the same instance but no name. Falls back to the constructor name.

    Methods

    • Release the resource. Must be idempotent — ShutdownAll() may be invoked more than once during a slow drain (e.g., SIGTERM followed by SIGINT). Should not throw; failures are logged and remaining shutdowns continue.

      Returns void | Promise<void>