You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

nator

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nator

The graceful shutdown handler for loop-based operating NodeJS apps.

0.0.2
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source
   _  _____ __________  ___ 
  / |/ / _ /_  __/ __ \/ _ \
 /    / __ |/ / / /_/ / , _/
/_/|_/_/ |_/_/  \____/_/|_| 

(Assasi)nator

The graceful shutdown handler for loop-based operating NodeJS apps.

Say what? E.g. a shutdown handler for apps that have a sequential execution flow loop (treadmill-like) as for example:

var doSomething = function() {
	// do something here
	doSomethingAgain();
}
var doSomethingAgain = function() {
	doSomething(); // again!
}

doSomething();

Usage

Given that your app is running on a treadmill (like the example above), all you need to do to handle graceful shutdowns (such that the last running loop will always finish up), is the following:

var Nator = require('nator');

var doSomething = function() {
	// do something here
	doSomethingAgain();
}
var doSomethingAgain = function() {
	doSomething(); // again!
}

var nator = new Nator.handler(doSomething);

nator.start();

Optionally, you may pass a custom shutdown function to the .start() that will execute upon receiving SIGINT, SIGHUP or SIGTERM signals. You will need to issue process.exit() on your own inside the shutdown function when doing so.

Licence

MIT.

FAQs

Package last updated on 16 May 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.