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

boring-cluster

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boring-cluster - npm Package Compare versions

Comparing version 1.0.5 to 1.1.0

9

index.js
var cluster = require('cluster')
var cpus = require('os').cpus
var len = cpus().length
function boringCluster (mod) {
function boringCluster (mod, opt) {
var opts = opt || {}
var len = opts.workers || cpus().length
var name = opts.name || ''
if (cluster.isMaster) {

@@ -13,3 +14,3 @@ for (var i = 0; i < len; i++) {

cluster.on('exit', function (worker) {
console.log(worker.process.pid + ' died; forking.')
console.log(name + name ? ' ' : '' + worker.process.pid + ' died; forking.')
cluster.fork()

@@ -16,0 +17,0 @@ })

{
"name": "boring-cluster",
"description": "A really boring cluster module",
"version": "1.0.5",
"version": "1.1.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Zac Anger",

@@ -24,2 +24,13 @@ # boring-cluster

An optional second argument can be passed with the shape
```javascript
{ workers: number, name: string }
```
Example:
```javascript
cluster(resolve(__dirname, 'some-thing'), { workers: 2, name: 'My Awesome App' })
```
Full example with an Express server:

@@ -31,3 +42,6 @@

const { resolve } = require('path')
cluster(resolve(__dirname, 'server'))
cluster(
resolve(__dirname, 'server'),
{ name: 'sweet server', workers: 2 }
)

@@ -34,0 +48,0 @@ // server.js

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