openvidu-server: change order of action upon KurentoClient disconnection (nodeCrashed)

pull/648/head
pabloFuente 2021-08-10 18:25:12 +02:00
parent 58c4d565f6
commit 8559ca96d4
1 changed files with 7 additions and 7 deletions

View File

@ -220,14 +220,14 @@ public abstract class KmsManager {
final List<String> affectedRecordingIds = kms.getActiveRecordings().stream() final List<String> affectedRecordingIds = kms.getActiveRecordings().stream()
.map(entry -> entry.getKey()).collect(Collectors.toUnmodifiableList()); .map(entry -> entry.getKey()).collect(Collectors.toUnmodifiableList());
sessionEventsHandler.onMediaNodeCrashed(kms, timeOfKurentoDisconnection, affectedSessionIds, // 1. Remove Media Node from cluster
affectedRecordingIds); log.warn("Removing Media Node {} after crash", kms.getId());
removeMediaNodeUponCrash(kms.getId());
// Close all sessions and recordings with reason "nodeCrashed" // 2. Close all sessions and recordings with reason "nodeCrashed"
log.warn("Closing {} sessions hosted by KMS with uri {}: {}", kms.getKurentoSessions().size(), log.warn("Closing {} sessions hosted by KMS with uri {}: {}", kms.getKurentoSessions().size(),
kms.getUri(), kms.getKurentoSessions().stream().map(s -> s.getSessionId()) kms.getUri(), kms.getKurentoSessions().stream().map(s -> s.getSessionId())
.collect(Collectors.joining(",", "[", "]"))); .collect(Collectors.joining(",", "[", "]")));
try { try {
// Flag the thread to skip remote operations to KMS // Flag the thread to skip remote operations to KMS
RemoteOperationUtils.setToSkipRemoteOperations(); RemoteOperationUtils.setToSkipRemoteOperations();
@ -236,9 +236,9 @@ public abstract class KmsManager {
RemoteOperationUtils.revertToRunRemoteOperations(); RemoteOperationUtils.revertToRunRemoteOperations();
} }
// Remove Media Node // 3. Send nodeCrashed webhook event
log.warn("Removing Media Node {} after crash", kms.getId()); sessionEventsHandler.onMediaNodeCrashed(kms, timeOfKurentoDisconnection, affectedSessionIds,
removeMediaNodeUponCrash(kms.getId()); affectedRecordingIds);
} else { } else {