Comparing version 0.1.0 to 0.1.1
@@ -7,4 +7,6 @@ // run with examples/master.js | ||
var unstoppableWorker = path.join(__dirname, 'unstoppable-worker.js'); | ||
var failedWorker = path.join(__dirname, 'failed-worker.js'); | ||
require('log-prefix')('MASTER PID/' + process.pid + ' says:'); | ||
var masterLog; | ||
var master = forkie.master([ | ||
@@ -16,5 +18,9 @@ workerFile, | ||
// should be killed with SIGKILL | ||
unstoppableWorker | ||
unstoppableWorker, | ||
failedWorker | ||
], { | ||
start: function(cb) { | ||
masterLog = setInterval(function() { | ||
console.log('master is alive') | ||
}, 250); | ||
console.log('will start workers in 500ms'); | ||
@@ -24,2 +30,3 @@ setTimeout(cb, 500); | ||
stop: function(cb) { | ||
clearInterval(masterLog); | ||
console.log('will stop workers in 200ms'); | ||
@@ -26,0 +33,0 @@ setTimeout(cb, 200) |
@@ -19,4 +19,4 @@ 'use strict'; | ||
var worker = worker('master process', { | ||
start: async.compose(start, opts.start), | ||
stop: async.compose(stop, opts.stop), | ||
start: async.series.bind(async, [opts.start, start]), | ||
stop: async.series.bind(async, [opts.stop, stop]) | ||
}); | ||
@@ -42,6 +42,10 @@ | ||
function waitForExit(proc, cb) { | ||
if (proc.connected !== true) { | ||
return process.nextTick(cb); | ||
} | ||
var forceKill = proc.kill.bind(proc, 'SIGKILL'); | ||
var killTimeout = setTimeout(forceKill, opts.killTimeout); | ||
proc.once('exit', workerExited); | ||
proc.addListener('exit', workerExited); | ||
@@ -83,3 +87,3 @@ function workerExited(code, signal) { | ||
function startFork(forkedProcess, cb) { | ||
forkedProcess.on('message', handleWorkerMessage); | ||
forkedProcess.addListener('message', handleWorkerMessage); | ||
@@ -86,0 +90,0 @@ function handleWorkerMessage(msg) { |
{ | ||
"name": "forkie", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "forkie likes your forks", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26424
14
731
1