Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add close ErizoController on KeepAlive failure #1067

Merged
merged 3 commits into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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