Interface: RunningLifecycle
Defined in: src/utils/lifecycle.ts:229
A started lifecycle, returned by startLifecycle.
Example
const running = await startLifecycle(app);
console.log('started', running.hooks);
process.once('SIGTERM', () => running.stop().catch((error) => logger.error(error)));
// in a test: stopped at the end of the block
await using test = await startLifecycle(app.fork({ isolated: true }));Properties
hooks
readonlyhooks: readonlyServiceKey[]
Defined in: src/utils/lifecycle.ts:233
The hook keys that ran, in the order they were started (for startup logs and tests).
state
readonlystate:LifecycleState
Defined in: src/utils/lifecycle.ts:231
started, then stopping and stopped once stop() is called.
Methods
[asyncDispose]()
[asyncDispose]():
Promise<void>
Defined in: src/utils/lifecycle.ts:242
Same as stop(); enables await using running = await startLifecycle(app).
Returns
Promise<void>
stop()
stop(
options?):Promise<void>
Defined in: src/utils/lifecycle.ts:240
Runs the undo functions in reverse order (stage by stage, the last stage first), then disposes the container (unless dispose: false). Returns the same promise when called again. Rejects with INJECUTE_DISPOSE_FAILED when some of them failed (each undo failure is an INJECUTE_UNDO_FAILED in cause.errors, with the hook's key in path); the others still ran.
Parameters
options?
Returns
Promise<void>