node_task 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 251a401a6d440f9a5fd7399519c12bef82ae32ff
4
- data.tar.gz: a159f15a8e6ad3f490b9bfb3fcc3c334170105bd
3
+ metadata.gz: 429964538de58dc704d0744dcc47ba0235ad3ad6
4
+ data.tar.gz: 609ffb512c33b4472591b5f9deb352330d05573f
5
5
  SHA512:
6
- metadata.gz: fc9a7866fd5eaddafbaec94ed2c7b892c8125a65d086705c18a8584069cbaaa9b6d4022dc221b7793dbac9ce44e68d7f4ba8fb6166cd3a86aef28d6aa7ba76d6
7
- data.tar.gz: 8d0b4430317f4af05480160b6270ea48815efa43ff5a1d73759ac54c97f4eacd991a02cafc67898e301eae1c4482ae91e6b6a930ded18fa911da08285e5bb677
6
+ metadata.gz: 9fc9e8f9a611445dbe8e5898187cf85f1ea94c452bbf766fa929f22eb0bd096145693a7c1d6f55747e6f79ed7146f15b0ed94a2dbb9e15912d619d4a9ef677a6
7
+ data.tar.gz: 8f7523b556b767d968399bd99cfb9aa0b185731db567afe428527b24b6ebc6647333c3cb0bd19c96355d65bf2d1c36076fb6f2f04351430e4b954d05cdea1225
@@ -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 = parseInt(process.env.NODE_TASK_DAEMON_ID, 10);
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(function() {
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 {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ruby_node_task",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "main": "nodeTask.js",
6
6
  "scripts": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: node_task
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Friend