eve.aio.shutdown
Graceful shutdown coordination for Layer 2 components.
This module provides a mechanism to coordinate the shutdown of multiple listeners and connections, ensuring that in-flight requests are finished before the process exits.
Types 3
enumShutdownPhase : ubyte
Phases of the graceful shutdown process.
RUNNINGServer is running normally.
DRAININGListeners are stopped, connections are draining.
TERMINATINGTimeout reached, remaining connections are being forced closed.
STOPPEDAll tracked resources are closed.
interfaceIShutdownTrackable
Interface for components that can be tracked by the ShutdownCoordinator.
This is an internal interface used by Layer 2 components to integrate with the graceful shutdown process.
Methods
bool isClosed() @property const @safe nothrow @nogcCheck if the component is fully closed and can be untracked.structShutdownCoordinator(uint MaxTracked = 1024)
Coordinator for graceful server shutdown.
Tracks active listeners and connections, and manages the multi-phase shutdown protocol to ensure clean termination.
Parameters
MaxTracked | Maximum number of components that can be tracked. |
Fields
private EventLoop * _loopprivate IShutdownTrackable[MaxTracked] _trackedprivate uint _countprivate CancelSource _shutdownSourceprivate ShutdownPhase _phaseprivate Token _drainTimerMethods
ShutdownCoordinator create(ref EventLoop loop) @trusted nothrowCreate a coordinator associated with an event loop.CancelToken shutdownToken() @property @safe nothrow @nogcGet the global shutdown cancellation token.