ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Server.Drain

Description

The graceful-shutdown drain vocabulary: the one-way DrainSignal the front door observes on every request, and the bound on how long a drain may run. Ecluse.Runtime.Server's runWarp raises the signal from the OS shutdown handler. The readiness probe and the going-away middleware (Ecluse.Runtime.Server.Middleware) read it.

Synopsis

Documentation

data DrainSignal Source #

The shutdown-drain flag the front door observes during a graceful rollover. Nothing lowers it again. The readiness probe and the going-away middleware read it per request.

newDrainSignal :: IO DrainSignal Source #

Allocate a live drain signal, lowered. runWarp allocates one per launch and raises it from the shutdown signal handler.

neverDraining :: DrainSignal Source #

The inert drain signal: permanently lowered, and raising it does nothing. It is the mkServerConfig default, so a socket-free test reports ready and stamps no going-away header.

beginDrain :: DrainSignal -> IO () Source #

Raise a drain signal: the one-way transition into draining. Idempotent.

isDraining :: DrainSignal -> IO Bool Source #

Read whether a drain signal is raised.

newtype ShutdownDrainTimeout Source #

The bound on the graceful drain, in seconds. The server stops accepting connections, waits this long for in-flight requests and artifact streams, then exits regardless.

defaultShutdownDrainTimeout :: ShutdownDrainTimeout Source #

The default graceful-drain bound: 30 seconds. It covers an in-flight metadata fetch or a moderate artifact stream, and stops a stuck request pinning the old instance.