New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-worker-pool

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-worker-pool - npm Package Compare versions

Comparing version 2.1.4 to 2.1.5

4

package.json
{
"name": "node-worker-pool",
"version": "2.1.4",
"version": "2.1.5",
"dependencies": {

@@ -13,4 +13,4 @@ "q": "~0.9.7"

"scripts": {
"test": "node node_modules/jest/bin/runTests.js --config=testConfig.json"
"test": "node node_modules/jest/bin/jest.js --config=testConfig.json"
}
}

@@ -63,5 +63,11 @@ # node-worker-pool

var workerPool = new WorkerPool(
8, // number of workers
8, // number of workers
process.execPath, // path to the node binary
'./worker.js' // path to the worker script
'./worker.js', // path to the worker script
{
// The initData object that is passed to each worker exactly once before
// any messages get sent. Workers receive this object via their
// onInitialize callback.
initData: {someUsefulConstant: 42}
}
);

@@ -68,0 +74,0 @@

@@ -50,10 +50,18 @@ "use strict";

delete this._queuedWorkerSpecificMessages[workerID];
this._sendMessageToWorker(workerID, queuedMsg.msg).done(function(response) {
queuedMsg.deferred.resolve(response);
});
this._sendMessageToWorker(workerID, queuedMsg.msg)
.catch(function(err) {
queuedMsg.deferred.reject(err);
})
.done(function(response) {
queuedMsg.deferred.resolve(response);
});
} else if (this._queuedMessages.length > 0) {
var queuedMsg = this._queuedMessages.shift();
this._sendMessageToWorker(workerID, queuedMsg.msg).done(function(response) {
queuedMsg.deferred.resolve(response);
})
this._sendMessageToWorker(workerID, queuedMsg.msg)
.catch(function(err) {
queuedMsg.deferred.reject(err);
})
.done(function(response) {
queuedMsg.deferred.resolve(response);
})
} else {

@@ -60,0 +68,0 @@ this._availableWorkers.push(workerID);

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