Akka-apps finishes all pending meeting in graphql on restarting (#19867)

This commit is contained in:
Gustavo Trott 2024-03-21 10:15:47 -03:00 committed by GitHub
parent f2c48a3c9b
commit e63af145b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 34 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import org.bigbluebutton.SystemConfiguration
import java.util.concurrent.TimeUnit
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.db.{ DatabaseConnection, MeetingDAO }
import org.bigbluebutton.core.domain.MeetingEndReason
import org.bigbluebutton.core.running.RunningMeeting
import org.bigbluebutton.core.util.ColorPicker
import org.bigbluebutton.core2.RunningMeetings
@ -57,6 +58,9 @@ class BigBlueButtonActor(
override def preStart() {
bbbMsgBus.subscribe(self, meetingManagerChannel)
DatabaseConnection.initialize()
//Terminate all previous meetings, as they will not function following the akka-apps restart
MeetingDAO.setAllMeetingsEnded(MeetingEndReason.ENDED_DUE_TO_SERVICE_INTERRUPTION, "system")
}
override def postStop() {

View File

@ -182,4 +182,27 @@ object MeetingDAO {
case Failure(e) => DatabaseConnection.logger.debug(s"Error updating endedAt=now() Meeting: $e")
}
}
def setAllMeetingsEnded(endedReasonCode: String, endedBy: String) = {
DatabaseConnection.db.run(
TableQuery[MeetingDbTableDef]
.filter(_.endedAt.isEmpty)
.map(a => (a.endedAt, a.endedReasonCode, a.endedBy))
.update(
(
Some(new java.sql.Timestamp(System.currentTimeMillis())),
Some(endedReasonCode),
endedBy match {
case "" => None
case c => Some(c)
}
)
)
).onComplete {
case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated all-meetings endedAt=now() on Meeting table!")
case Failure(e) => DatabaseConnection.logger.debug(s"Error updating all-meetings endedAt=now() on Meeting table: $e")
}
}
}

View File

@ -42,4 +42,5 @@ object MeetingEndReason {
val BREAKOUT_ENDED_BY_MOD = "BREAKOUT_ENDED_BY_MOD"
val ENDED_DUE_TO_NO_AUTHED_USER = "ENDED_DUE_TO_NO_AUTHED_USER"
val ENDED_DUE_TO_NO_MODERATOR = "ENDED_DUE_TO_NO_MODERATOR"
val ENDED_DUE_TO_SERVICE_INTERRUPTION = "ENDED_DUE_TO_SERVICE_INTERRUPTION"
}

View File

@ -159,6 +159,10 @@ const intlMessage = defineMessages({
id: 'app.meeting.endedDueNoModerators',
description: '',
},
[MeetingEndedTable.ENDED_DUE_TO_SERVICE_INTERRUPTION]: {
id: 'app.meeting.endedDueServiceInterruption',
description: '',
},
});
interface MeetingEndedContainerProps {

View File

@ -21,6 +21,7 @@ export const MeetingEndedTable = {
BREAKOUT_ENDED_BY_MOD: 'BREAKOUT_ENDED_BY_MOD',
ENDED_DUE_TO_NO_AUTHED_USER: 'ENDED_DUE_TO_NO_AUTHED_USER',
ENDED_DUE_TO_NO_MODERATOR: 'ENDED_DUE_TO_NO_MODERATOR',
ENDED_DUE_TO_SERVICE_INTERRUPTION: 'ENDED_DUE_TO_SERVICE_INTERRUPTION',
};
export const openLearningDashboardUrl = (

View File

@ -244,6 +244,7 @@
"app.meeting.breakoutEndedByModerator": "Breakout was terminated by Moderator",
"app.meeting.endedDueNoAuthed": "the meeting was ended because no authed user in the room",
"app.meeting.endedDueNoModerators": "The meeting has ended because no moderator has been present in the meeting",
"app.meeting.endedDueServiceInterruption": "The meeting has terminated due to a temporary service interruption",
"app.meeting.meetingTimeRemaining": "Meeting time remaining: {0}",
"app.meeting.meetingTimeHasEnded": "Time ended. Meeting will close soon",
"app.meeting.endedByUserMessage": "This session was ended by {0}",