Kind: Interface
Source: packages/common/interfaces/shutdown-hooks-options.interface.ts
Part of: Common
Options for configuring shutdown hooks behavior.
ShutdownHooksOptions configures how application shutdown hooks behave. It currently controls whether the shutdown process should explicitly terminate the Node.js process after registered cleanup handlers have completed.
Properties
| Property | Type |
|---|---|
useProcessExit | boolean |
Diagram
mermaidgraph LR A[Application shutdown signal] --> B[Shutdown hooks handler] B --> C[Run registered cleanup hooks] C --> D{useProcessExit?} D -->|true| E[Call process.exit] D -->|false| F[Allow event loop to exit naturally]
Usage
tsimport type { ShutdownHooksOptions } from '@package/common';
const shutdownOptions: ShutdownHooksOptions = {
useProcessExit: true,
};
// Pass options when configuring the application's shutdown handling.
configureShutdownHooks(shutdownOptions);
AI Coding Instructions
- Set
useProcessExittotrueonly when the application must terminate immediately after cleanup hooks finish. - Prefer
falsewhen open resources should be allowed to close naturally through the Node.js event loop. - Ensure shutdown hooks complete asynchronous cleanup before process termination is triggered.
- Keep this interface focused on shutdown behavior; add new lifecycle configuration options as explicit, typed fields.
Used by
1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Imported by (1)
NestApplicationContext—packages/core/nest-application-context.ts:40
Was this page helpful?