Skip to content

Commit

Permalink
Add close ErizoController on KeepAlive failure (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun authored Nov 10, 2017
1 parent dfb674e commit a69ece9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions erizo_controller/erizoController/erizoController.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ global.config.erizoController.report.session_events =
global.config.erizoController.report.session_events || false;
global.config.erizoController.recording_path =
global.config.erizoController.recording_path || undefined;
global.config.erizoController.exitOnNuveCheckFail = global.config.erizoController.exitOnNuveCheckFail || false;
// jshint ignore:end
global.config.erizoController.roles = global.config.erizoController.roles ||
{'presenter': {'publish': true, 'subscribe': true, 'record': true},
Expand Down Expand Up @@ -132,6 +133,7 @@ var io = require('socket.io').listen(server, {log:false});

io.set('transports', ['websocket']);

var EXIT_ON_NUVE_CHECK_FAIL = global.config.erizoController.exitOnNuveCheckFail;
var WARNING_N_ROOMS = global.config.erizoController.warning_n_rooms; // jshint ignore:line
var LIMIT_N_ROOMS = global.config.erizoController.limit_n_rooms; // jshint ignore:line

Expand Down Expand Up @@ -196,7 +198,15 @@ var addToCloudHandler = function (callback) {
}
return true;
}).then((result) => {
if (!result) return nuve.killMe(publicIP);
if (!result) {
nuve.killMe(publicIP);
if (EXIT_ON_NUVE_CHECK_FAIL) {
log.error('message: Closing ErizoController ' +
'- does not exist in Nuve CloudHandler');
process.exit(-1);
}
}

});
}, INTERVAL_TIME_KEEPALIVE);
};
Expand Down Expand Up @@ -225,7 +235,7 @@ var addToCloudHandler = function (callback) {
callback('callback');
}).catch(reason => {
if (reason === 'timeout') {
log.warn('message: addECToCloudHandler cloudHandler does not respondr, ' +
log.warn('message: addECToCloudHandler cloudHandler does not respond, ' +
'attemptsLeft: ' + attempt );

// We'll try it more!
Expand Down
2 changes: 2 additions & 0 deletions scripts/licode_default.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ config.erizoController.listen_port = 8080; //default value: 8080
// Use the name of the inferface you want to bind to for websockets
// config.erizoController.networkInterface = 'eth1' // default value: undefined

config.erizoController.exitOnNuveCheckFail = false; // default value: false

config.erizoController.warning_n_rooms = 15; // default value: 15
config.erizoController.limit_n_rooms = 20; // default value: 20
config.erizoController.interval_time_keepAlive = 1000; // default value: 1000
Expand Down

0 comments on commit a69ece9

Please sign in to comment.