Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

throng

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

throng

A simple worker-manager for clustered apps

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
53K
decreased by-14.56%
Maintainers
1
Weekly downloads
 
Created
Source

Throng

Dead-simple one-liner for clustered apps.

throng(start, { workers: 3 });

function start() {
  console.log('Started worker');

  process.on('SIGTERM', function() {
    console.log('Worker exiting');
    process.exit();
  });
}

Installation

npm install --save throng

Use

throng(startFunction, options);

Options

workers

Number of Cluster workers to create. Defaults to number of CPUs available.

lifetime

Minimum time to keep the Cluster alive (by forking new workers if any die).

In milliseconds; defaults to zero.

(Infinity = stay up forever)

grace

Grace period for worker shutdown. Once each worker is sent SIGTERM, the grace period starts. Any workers still alive when it ends are killed.

In milliseconds; defaults to 5000.

Example

This is how you might use throng in a web server:

var throng = require('throng');

throng(start, {
  workers: 4,
  lifetime: Infinity,
  grace: 4000
});

Tests

npm test

Keywords

FAQs

Package last updated on 10 Sep 2015

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc