-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: cleanup mcs-core rooms by tying them to akka-apps lifecycle
Should avoid stuck rooms/users on the majority of scenarios
- Loading branch information
1 parent
788ac8f
commit ee2fd63
Showing
12 changed files
with
133 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const config = require('config'); | ||
const RedisGateway = (new (require('../bbb/pubsub/bbb-gw'))); | ||
const MCSAgent = require('./mcs-agent.js'); | ||
const Logger = require('../common/logger.js'); | ||
|
||
const { TO_VOICE_CONF } = require('../bbb/messages/Constants'); | ||
const DESTROY_ROOM_ON_EJECT = config.has('destroyRoomOnEject') | ||
? config.get('destroyRoomOnEject') | ||
: false; | ||
const EJECT_ALL_FROM_VOICE_CONF = 'EjectAllFromVoiceConfMsg'; | ||
|
||
const _destroyRoomOnEjectAllFromVoiceConf = () => { | ||
if (!DESTROY_ROOM_ON_EJECT) return; | ||
|
||
RedisGateway.on(EJECT_ALL_FROM_VOICE_CONF, ({ body }) => { | ||
const { voiceConf } = body; | ||
|
||
if (voiceConf) { | ||
MCSAgent.destroyRoom(voiceConf).then(() => { | ||
Logger.info('[main-janitor] Requested room destruction on EjectAllFromVoiceConfMsg', { | ||
voiceConf, | ||
}); | ||
}).catch(error => { | ||
Logger.error('[main-janitor] Room destruction on EjectAllFromVoiceConfMsg failed', { | ||
voiceConf, errorMessage: error.message, errorCode: error.code, | ||
}); | ||
}); | ||
} | ||
}); | ||
}; | ||
|
||
|
||
const clockIn = () => { | ||
RedisGateway.addSubscribeChannel(TO_VOICE_CONF); | ||
_destroyRoomOnEjectAllFromVoiceConf(); | ||
}; | ||
|
||
|
||
module.exports = { | ||
clockIn, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const config = require('config'); | ||
const MCS = require('../base/MCSAPIWrapper.js'); | ||
const Logger = require('../common/logger.js'); | ||
|
||
const MCS_ADDRESS = config.get("mcs-address"); | ||
const MCS_PORT = config.get("mcs-port"); | ||
|
||
const mcs = new MCS() | ||
|
||
mcs.start(MCS_ADDRESS, MCS_PORT).catch(error => { | ||
Logger.error('[main-process] Failed to establish MCS connection', { | ||
errorMessage: error.message, errorCode: error.code, | ||
}); | ||
}) | ||
|
||
module.exports = mcs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters