Interface: StartLifecycleOptions<S>
Defined in: src/utils/lifecycle.ts:169
Options of startLifecycle.
Example
const running = await startLifecycle(app, {
lifecycle: stages, // createLifecycle(['migrate', 'init', 'start'])
concurrent: ['init'],
signal: AbortSignal.timeout(30_000),
onError: (error) => logger.warn(error),
});Type Parameters
S
S extends string
Properties
concurrent?
optionalconcurrent?:boolean| readonly [S][Sextendsany?0:never][]
Defined in: src/utils/lifecycle.ts:174
Stages whose hooks run concurrently, or true for every stage. Default: false (one by one).
dispose?
optionaldispose?:boolean
Defined in: src/utils/lifecycle.ts:179
Dispose the container after running.stop() and after a failed start. Default: true. Pass false when something else disposes the container.
lifecycle?
optionallifecycle?:Lifecycle<S>
Defined in: src/utils/lifecycle.ts:171
The stages to run, made by createLifecycle. Default: lifecycle (init, start, ready).
onError?
optionalonError?: (error,context) =>void
Defined in: src/utils/lifecycle.ts:191
Receives the failures of a failed start that come after the first one (which startLifecycle() rejects with). Without it, they are dropped.
Parameters
error
unknown
context
Returns
void
onHook?
optionalonHook?: (event) =>void
Defined in: src/utils/lifecycle.ts:196
Called after each hook runs and after each undo function, with the time it took: for startup logs, metrics and finding slow hooks.
Parameters
event
Returns
void
signal?
optionalsignal?:AbortSignalLike
Defined in: src/utils/lifecycle.ts:186
Aborts a start that takes too long: the runner stops waiting for the pending hooks, undoes what ran (its undo functions receive the aborted signal and are waited for), disposes and rejects. A hook that finishes later is undone when it does; while it runs, disposing continues in the background.