How to use the async-exit-hook.forceExitTimeout function in async-exit-hook

To help you get started, we’ve selected a few async-exit-hook examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RiseVision / rise-node / src / app.ts View on Github external
* Returns cleanup function
 */
async function boot(constants: typeof constantsType): Promise {
  const manager = new AppManager(
    appConfig,
    logger,
    versionBuild,
    genesisBlock,
    constants,
    allExceptionCreator
  );
  await manager.boot();
  return manager;
}

exitHook.forceExitTimeout(15000);
exitHook.unhandledRejectionHandler((err) => {
  logger.fatal('Unhandled Promise rejection', err);
});

boot(constantsType)
  .catch((err) => {
    logger.fatal('Error when instantiating');
    logger.fatal(err);
    process.exit(1);
    return Promise.reject(err);
  })
  .then((manager) => {
    exitHook((cb) => promiseToCB(manager.tearDown(), cb));
  });
github RiseVision / rise-node / packages / core-launchpad / src / app.ts View on Github external
* Takes care of bootstrapping the application
 * Returns cleanup function
 */
async function boot(): Promise {
  const manager = new AppManager(
    appConfig,
    logger,
    callingPackageJSON.version,
    genesisBlock,
    modules
  );
  await manager.boot();
  return manager;
}

exitHook.forceExitTimeout(15000);
exitHook.unhandledRejectionHandler((err) => {
  logger.fatal('Unhandled Promise rejection', err);
});

boot()
  .catch((err) => {
    logger.fatal('Error when instantiating');
    logger.fatal(err);
    return Promise.reject(err);
  })
  .then((manager) => {
    exitHook((cb) => promiseToCB(manager.tearDown(), cb));
  });
github atomist / automation-client / lib / internal / util / shutdown.ts View on Github external
export function setForceExitTimeout(ms: number): void {
    exitHook.forceExitTimeout(ms);
}

async-exit-hook

Run some code when the process exits (supports async hooks and pm2 clustering)

MIT
Latest version published 7 years ago

Package Health Score

65 / 100
Full package analysis