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

csteer

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csteer

Handling refork in cluster

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

csteer

Build Status

Run your app in cluster mode and refork it automatically when it was exit unexpectedly.

Install

npm install csteer

Usage

'use strict'
const csteer = require('csteer')

csteer({
  exec: '/path/to/your/app',
  limit: 60,
  duration: 60 * 1000
})
.on('fork', (worker) => {
  console.log(`[${worker.process.pid}] worker start`)
})
.on('disconnect', (worker) => {
  console.warn(`[${worker.process.pid}] worker disconnect`)
})
.on('exit', (worker, code, signal) => {
  console.error(`[${worker.process.pid}] worker exit, code: ${code}, signal: ${signal}`)
})
.on('reachReforkLimit', () => {
  console.warn('lol')
})

API

csteer(options)

  • options
    • exec (String) - path to your app
    • args (Array) - the arguments passing to the exec
    • instance(Number) - the number of workers which will be forked, by default it is os.cpus().length
    • limit(Number) - the times csteer will refork in duration, if it is set to be null, then there will be no limit, by default it is 60
    • duration(Number) - by default it is 60000

Events

reachReforkLimit

Emitted when the times of refork over the options.limit in options.duration ms.

unexpectedExit

function (worker, code, signal) {}

Emitted when the worker process exit unexpectedly.

FAQs

Package last updated on 08 Mar 2016

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