Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@mangar2/shutdown

1.0.2 • Public • Published

Table of Contents

Shutdown

Shutdown is a small helper to safely shutdown serivces on SIGINT (ctrl-C) A singelton calling a callback on SIGINT and provides a timeout if the callback does not finish in a period of time.

Examples

const shutdown = require('shutdown');
 
shutdown(async () => {
   await myClass.close();
   process.exit(0);
});

Meta

  • copyright: Copyright (c) 2020 Volker Böhm

  • author: Volker Böhm

  • license: This software is licensed under the GNU LESSER GENERAL PUBLIC LICENSE Version 3. It is furnished "as is", without any support, and with no warranty, express or implied, as to its usefulness for any purpose.

shutdown

Parameters

  • callback function function called on sigint before shutdown
  • forceShutdownTimeoutInMilliseconds number amount of milliseconds until shutdown is forced (optional, default FORCE_SHUTDOWN_TIMEOUT_IN_MILLISECONDS)

Install

npm i @mangar2/shutdown

DownloadsWeekly Downloads

5

Version

1.0.2

License

LGPL-3.0-or-later

Unpacked Size

4.77 kB

Total Files

4

Last publish

Collaborators

  • avatar