node_task 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/node_task/nodeTask.js +14 -12
- data/lib/node_task/package.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 429964538de58dc704d0744dcc47ba0235ad3ad6
|
4
|
+
data.tar.gz: 609ffb512c33b4472591b5f9deb352330d05573f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fc9e8f9a611445dbe8e5898187cf85f1ea94c452bbf766fa929f22eb0bd096145693a7c1d6f55747e6f79ed7146f15b0ed94a2dbb9e15912d619d4a9ef677a6
|
7
|
+
data.tar.gz: 8f7523b556b767d968399bd99cfb9aa0b185731db567afe428527b24b6ebc6647333c3cb0bd19c96355d65bf2d1c36076fb6f2f04351430e4b954d05cdea1225
|
data/lib/node_task/nodeTask.js
CHANGED
@@ -3,8 +3,8 @@ var path = require('path')
|
|
3
3
|
var net = require('net')
|
4
4
|
var ndjson = require('ndjson')
|
5
5
|
|
6
|
-
var parentCheckInterval = parseInt(process.env.NODE_TASK_PARENT_CHECK_INTERVAL, 10) || 1000
|
7
|
-
var parentPid =
|
6
|
+
var parentCheckInterval = parseInt(process.env.NODE_TASK_PARENT_CHECK_INTERVAL, 10) || 1000
|
7
|
+
var parentPid = String(process.env.NODE_TASK_DAEMON_ID)
|
8
8
|
|
9
9
|
var workingDir = path.resolve(process.env.NODE_TASK_CWD || __dirname)
|
10
10
|
var errorLogPath = path.join(workingDir, 'ruby_node_task-error.log')
|
@@ -27,16 +27,7 @@ var server = net.createServer(onClientConnect)
|
|
27
27
|
process.on('exit', onExit)
|
28
28
|
process.on('uncaughtException', onUncaughtException)
|
29
29
|
|
30
|
-
setInterval(
|
31
|
-
try {
|
32
|
-
process.kill(parentPid, 0);
|
33
|
-
} catch (err) {
|
34
|
-
if (err.code === 'ESRCH') {
|
35
|
-
logger.debug('parent '+parentPid+' is no longer alive, exiting')
|
36
|
-
process.exit()
|
37
|
-
}
|
38
|
-
}
|
39
|
-
}, parentCheckInterval);
|
30
|
+
setInterval(checkParentAliveOrExit, parentCheckInterval)
|
40
31
|
|
41
32
|
// the important part
|
42
33
|
function onClientConnect(socket) {
|
@@ -106,6 +97,17 @@ function onExit() {
|
|
106
97
|
}
|
107
98
|
}
|
108
99
|
|
100
|
+
function checkParentAliveOrExit() {
|
101
|
+
try {
|
102
|
+
process.kill(parentPid, 0)
|
103
|
+
} catch (err) {
|
104
|
+
if (err.code === 'ESRCH') {
|
105
|
+
logger.debug('parent '+parentPid+' is no longer alive, exiting')
|
106
|
+
process.exit()
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
109
111
|
function makeLogger(logFilePath, debug) {
|
110
112
|
function log(level, msg) {
|
111
113
|
try {
|
data/lib/node_task/package.json
CHANGED