Skip to content
Snippets Groups Projects
Commit 556b2c00 authored by prlanzarin's avatar prlanzarin
Browse files

Added failover to prevent hanging processes in SFU

parent bccb8d51
No related branches found
No related tags found
Loading
......@@ -28,9 +28,10 @@ module.exports = class BaseProcess {
async stop () {
try {
this.runningState = "STOPPING";
await this.manager.stopAll();
Logger.info(this.logPrefix, "Exiting process with code 0");
process.exit();
Promise.race([this.manager.stopAll(), this._failOver()]).then(() => {
Logger.info(this.logPrefix, "Exiting process with code 0");
process.exit();
});
}
catch (err) {
Logger.error(this.logPrefix, err);
......@@ -39,6 +40,12 @@ module.exports = class BaseProcess {
}
}
_failOver () {
return new Promise((resolve, reject) => {
setTimeout(resolve, 5000);
});
}
handleException (error) {
Logger.error(this.logPrefix, 'TODO => Uncaught exception', error.stack);
if (this.runningState === "STOPPING") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment