@imqueue/rpc 1.13.13 → 1.13.14
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.
- package/package.json +1 -1
- package/src/IMQClient.js +2 -4
- package/src/IMQService.js +2 -4
- package/src/helpers/pid.js +6 -1
package/package.json
CHANGED
package/src/IMQClient.js
CHANGED
|
@@ -63,13 +63,11 @@ class IMQClient extends events_1.EventEmitter {
|
|
|
63
63
|
this.name = `${baseName}-${(0, _1.osUuid)()}-${this.id}:client`;
|
|
64
64
|
this.serviceName = serviceName || baseName.replace(/Client$/, '');
|
|
65
65
|
this.imq = core_1.default.create(this.name, this.options);
|
|
66
|
-
|
|
66
|
+
_1.SIGNALS.forEach((signal) => process.on(signal, async () => {
|
|
67
67
|
this.destroy().catch(this.logger.error);
|
|
68
68
|
// istanbul ignore next
|
|
69
69
|
setTimeout(() => process.exit(0), core_1.IMQ_SHUTDOWN_TIMEOUT);
|
|
70
|
-
};
|
|
71
|
-
_1.SIGNALS.forEach((signal) => process.on(signal, terminate));
|
|
72
|
-
process.on('exit', terminate);
|
|
70
|
+
}));
|
|
73
71
|
}
|
|
74
72
|
/**
|
|
75
73
|
* Sends call to remote service method
|
package/src/IMQService.js
CHANGED
|
@@ -88,13 +88,11 @@ class IMQService {
|
|
|
88
88
|
this.logger = this.options.logger || /* istanbul ignore next */ console;
|
|
89
89
|
this.imq = core_1.default.create(this.name, this.options);
|
|
90
90
|
this.handleRequest = this.handleRequest.bind(this);
|
|
91
|
-
|
|
91
|
+
_1.SIGNALS.forEach((signal) => process.on(signal, async () => {
|
|
92
92
|
this.destroy().catch(this.logger.error);
|
|
93
93
|
// istanbul ignore next
|
|
94
94
|
setTimeout(() => process.exit(0), core_1.IMQ_SHUTDOWN_TIMEOUT);
|
|
95
|
-
};
|
|
96
|
-
_1.SIGNALS.forEach((signal) => process.on(signal, terminate));
|
|
97
|
-
process.on('exit', terminate);
|
|
95
|
+
}));
|
|
98
96
|
this.imq.on('message', this.handleRequest);
|
|
99
97
|
}
|
|
100
98
|
/**
|
package/src/helpers/pid.js
CHANGED
|
@@ -20,7 +20,12 @@ exports.forgetPid = exports.pid = exports.IMQ_PID_DIR = exports.IMQ_TMP_DIR = ex
|
|
|
20
20
|
*/
|
|
21
21
|
const path = require("path");
|
|
22
22
|
const fs = require("fs");
|
|
23
|
-
exports.SIGNALS = [
|
|
23
|
+
exports.SIGNALS = [
|
|
24
|
+
'SIGTERM',
|
|
25
|
+
'SIGINT',
|
|
26
|
+
'SIGHUP',
|
|
27
|
+
'SIGQUIT',
|
|
28
|
+
];
|
|
24
29
|
exports.IMQ_TMP_DIR = process.env.TMPDIR ||
|
|
25
30
|
// istanbul ignore next
|
|
26
31
|
'/tmp';
|