Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "internal/util/shutdown"

Index

Variables

Const defaultGracePeriod

defaultGracePeriod: 10000 = 10000

Believe or not, this is the default grace period.

Let shutdownHooks

shutdownHooks: ShutdownHook[] = []

Functions

executeShutdownHooks

  • executeShutdownHooks(cb: () => never): Promise<never>
  • Run each shutdown hook and collect its result.

    Parameters

    • cb: () => never
        • (): never
        • Returns never

    Returns Promise<never>

registerShutdownHook

  • registerShutdownHook(cb: () => Promise<number>, priority?: number, desc?: string): void
  • Add callback to run when shutdown is initiated prior to process exit. See ShutdownHook for description of parameters.

    Parameters

    • cb: () => Promise<number>
        • (): Promise<number>
        • Returns Promise<number>

    • Default value priority: number = 1000
    • Optional desc: string

    Returns void

safeExit

  • safeExit(code: number): void
  • Register a final shutdown hook that calls process.exit(code) and then initiates shutdown. This allows you to exit with a specific exit code and process all async shutdown hooks, something not possible when calling process.exit directly.

    For the fastest safe exit, set the automation client configuration ws.termination.graceful to false before calling this.

    Parameters

    • code: number

      Exit code

    Returns void

setForceExitTimeout

  • setForceExitTimeout(ms: number): void

terminationGracePeriod

terminationGraceful

Generated using TypeDoc