Skip to content

Commit 5443ded

Browse files
author
Amoki
committed
some improvments
1 parent 8b5e6a4 commit 5443ded

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/helpers/child-process.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ process.on('message', function(task) {
8080

8181
process.on('SIGTERM', function() {
8282
if(file_path) {
83-
fs.unlinkSync(path);
83+
try {
84+
fs.unlinkSync(path);
85+
}
86+
catch (err) {}
8487
}
8588
process.disconnect();
8689
process.exit(0);

lib/helpers/hydrater.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ module.exports = function(hydraterFunction, logger, errLogger) {
4949
*/
5050
var cleaner = function(err, changes) {
5151
if(!cleaner.called) {
52-
if(child.connected) {
53-
child.kill('SIGKILL');
54-
}
5552
cleaner.called = true;
5653
cb(err, changes);
5754
}
@@ -127,6 +124,9 @@ module.exports = function(hydraterFunction, logger, errLogger) {
127124
errLogger('Killing task: ' + ((task.file_path) ? task.file_path : task.document.id));
128125
child.kill('SIGTERM');
129126
setTimeout(function() {
127+
if(child.connected) {
128+
child.kill('SIGKILL');
129+
}
130130
cleaner(null, changes);
131131
}, 10 * 1000);
132132
}

0 commit comments

Comments
 (0)