@atomist/automation-client
Version:
Atomist API for software low-level client
54 lines • 1.98 kB
TypeScript
import { Configuration } from "../../configuration";
/** Believe or not, this is the default grace period. */
export declare const defaultGracePeriod = 10000;
/**
* Return whether graceful termination is enabled.
*/
export declare function terminationGraceful(cfg: Configuration): boolean;
/**
* Return graceful termination period in milliseconds.
*/
export declare function terminationGracePeriod(cfg: Configuration): number;
/**
* Shutdown hook function and metadata.
*/
export interface ShutdownHook {
/** Function to call at shutdown. */
hook: () => Promise<number>;
/**
* Priority of hook. Lower number values are executed first. The
* number provided should be greater than 0 and less 100000.
* Using a priority outside (0, 100000) may interfere with
* internal shutdown behaviors.
*/
priority: number;
/** Optional description used in logging. */
description?: string;
}
/**
* Add callback to run when shutdown is initiated prior to process
* exit. See [[ShutdownHook]] for description of parameters.
*/
export declare function registerShutdownHook(cb: () => Promise<number>, priority?: number, desc?: string): void;
/**
* Run each shutdown hook and collect its result.
*/
export declare function executeShutdownHooks(cb: () => never): Promise<never>;
/**
* Set the absolute longest number of milliseconds shutdown should
* take.
*/
export declare function setForceExitTimeout(ms: 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.
*
* @param code Exit code
*/
export declare function safeExit(code: number): void;
//# sourceMappingURL=shutdown.d.ts.map