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

luster

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

luster - npm Package Compare versions

Comparing version 0.6.1 to 0.6.2

28

lib/master.js

@@ -432,2 +432,30 @@ var os = require('os'),

/**
* Broadcast event to all workers.
* @method
* @param {String} event of called command in the worker
* @param {*} ...args
* @public
*/
Master.prototype.broadcastEventToAll = function() {
var args = Array.prototype.slice.call(arguments, 0);
this.forEach(function(worker) {
if (worker.ready) {
worker.broadcastEvent.apply(worker, args);
}
});
};
/**
* Emit event on master and all workers in "ready" state.
* @method
* @param {String} event of called command in the worker
* @param {*} ...args
* @public
*/
Master.prototype.emitToAll = function() {
this.emit.apply(this, arguments);
this.broadcastEventToAll.apply(this, arguments);
};
/**
* @event Master#shutdown

@@ -434,0 +462,0 @@ */

3

lib/rpc.js

@@ -50,2 +50,3 @@ /**

worker : {
broadcastMasterEvent : 'core.worker.broadcastMasterEvent',
applyForeignProperties : 'core.worker.applyForeignProperties'

@@ -59,2 +60,2 @@ },

module.exports = RPC;
module.exports = RPC;

@@ -630,2 +630,6 @@ var cluster = require('cluster'),

WorkerWrapper.prototype.broadcastEvent = function() {
this.remoteCall(RPC.fns.worker.broadcastMasterEvent, Array.prototype.slice.call(arguments, 0));
};
module.exports = WorkerWrapper;

@@ -42,5 +42,14 @@ var cluster = require('cluster'),

this.registerRemoteCommand(RPC.fns.worker.applyForeignProperties, this.applyForeignProperties.bind(this));
this.registerRemoteCommand(RPC.fns.worker.broadcastMasterEvent, this.broadcastMasterEvent.bind(this));
});
/**
* Emit an event received from the master as 'master <event>'.
*/
Worker.prototype.broadcastMasterEvent = function(proc, emitArgs) {
var args = [ 'master ' + emitArgs[0] ].concat(emitArgs.slice(1));
this.emit.apply(this, args);
};
/**
* Transmit worker event to master, which plays as relay,

@@ -47,0 +56,0 @@ * retransmitting it as 'worker <event>' to all master-side listeners.

{
"name" : "luster",
"version" : "0.6.1",
"version" : "0.6.2",
"description" : "Node.js cluster wrapper",

@@ -5,0 +5,0 @@ "main" : "./lib/luster.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