Skip to content

Function: gracefulShutdown() ​

ts
function gracefulShutdown(components): GracefulShutdownHandle;

Defined in: glide-mq/src/graceful-shutdown.ts:24

Register SIGTERM and SIGINT handlers that gracefully close all provided components. Returns a Promise that resolves when all components have been closed. A second signal while shutdown is still running removes these handlers and re-raises that signal, so the process gets its default handling (exit) instead of the signal being swallowed behind a hung close().

Usage: const shutdown = gracefulShutdown([queue, worker, queueEvents]); // ... later, on signal or manually: await shutdown;

Parameters ​

ParameterType
componentsCloseable[]

Returns ​

GracefulShutdownHandle

Released under the Apache-2.0 License.