Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit cce6e42

Browse files
authored
Change amqp dependency and client logic (#922)
* Change amqp dependency and client logic
1 parent 2a88431 commit cce6e42

34 files changed

+708
-117
lines changed

source/agent/analytics/dist.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"../nodeManager.js",
1717
"../workingNode.js",
1818
"../../common/cipher.js",
19-
"../../common/amqp_client.js",
19+
"../../common/amqpClient.js",
2020
"../../common/cipher.js",
2121
"../../common/clusterWorker.js",
2222
"../../common/loadCollector.js",

source/agent/analytics/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "OWT-Server-Agent",
33
"version":"5.0.0",
44
"dependencies": {
5-
"amqp": "*",
5+
"amqplib": "^0.7.0",
66
"log4js": "^1.1.1",
77
"node-getopt": "*",
88
"toml": "*"

source/agent/audio/dist.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"../workingNode.js",
1616
"log4cxx.properties",
1717
"../../common/cipher.js",
18-
"../../common/amqp_client.js",
18+
"../../common/amqpClient.js",
1919
"../../common/clusterWorker.js",
2020
"../../common/loadCollector.js",
2121
"../../common/logger.js",

source/agent/conference/conference.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ var Conference = function (rpcClient, selfRpcId) {
509509
return Promise.all(pl)
510510
.then(() => {
511511
doClean();
512-
process.exit();
512+
process.kill(process.pid, 'SIGINT');
513513
});
514514
};
515515

source/agent/conference/dist.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"../networkHelper.js",
2323
"../../common/formatUtil.js",
2424
"../../common/cipher.js",
25-
"../../common/amqp_client.js",
25+
"../../common/amqpClient.js",
2626
"../../common/clusterWorker.js",
2727
"../../common/loadCollector.js",
2828
"../../common/logger.js",

source/agent/conference/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "OWT-Server-Conference-Controller",
33
"version":"5.0.0",
44
"dependencies": {
5-
"amqp": "*",
5+
"amqplib": "^0.7.0",
66
"log4js": "^1.1.1",
77
"node-getopt": "*",
88
"toml": "*",

source/agent/index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ for (var prop in opt.options) {
5252

5353
var clusterWorker = require('./clusterWorker');
5454
var nodeManager = require('./nodeManager');
55-
var amqper = require('./amqp_client')();
55+
var amqper = require('./amqpClient')();
5656
var rpcClient;
5757
var monitoringTarget;
5858

@@ -221,16 +221,21 @@ amqper.connect(config.rabbit, function () {
221221
});
222222

223223
['SIGINT', 'SIGTERM'].map(function (sig) {
224-
process.on(sig, function () {
224+
process.on(sig, async function () {
225225
log.warn('Exiting on', sig);
226+
manager && manager.dropAllNodes(true);
227+
worker && worker.quit();
228+
try {
229+
await amqper.disconnect();
230+
} catch(e) {
231+
log.warn('Exiting e:', e);
232+
}
226233
process.exit();
227234
});
228235
});
229236

230237
process.on('exit', function () {
231-
manager && manager.dropAllNodes(true);
232-
worker && worker.quit();
233-
amqper.disconnect();
238+
log.info('Process exit');
234239
});
235240

236241
process.on('unhandledRejection', (reason) => {

source/agent/nodeManager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ module.exports = function (spec, spawnOptions, onNodeAbnormallyQuit, onTaskAdded
309309
};
310310

311311
that.dropAllNodes = function(quietly) {
312+
spawn_failed = true;
312313
Object.keys(processes).map(function (k) {
313314
!quietly && onNodeAbnormallyQuit && onNodeAbnormallyQuit(k, tasksOnNode(k));
314315
dropNode(k);

source/agent/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "OWT-Server-Agent",
33
"version":"5.0.0",
44
"dependencies": {
5-
"amqp": "*",
5+
"amqplib": "^0.7.0",
66
"log4js": "^1.1.1",
77
"node-getopt": "*",
88
"toml": "*"

source/agent/quic/dist.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"../workingNode.js",
1414
"../InternalConnectionFactory.js",
1515
"log4cxx.properties",
16-
"../../common/amqp_client.js",
16+
"../../common/amqpClient.js",
1717
"../../common/cipher.js",
1818
"../../common/clusterWorker.js",
1919
"../../common/loadCollector.js",

0 commit comments

Comments
 (0)