mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: fix https://github.com/OpenVidu/openvidu/issues/824
parent
d9d524b23c
commit
a830033388
|
@ -690,8 +690,7 @@ public class RecordingManager {
|
||||||
if (session.isClosed()) {
|
if (session.isClosed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (session.getParticipants().size() == 0
|
if (session.onlyRecorderAndOrSttAndOrBroadcastParticipant()) {
|
||||||
|| session.onlyRecorderAndOrSttAndOrBroadcastParticipant()) {
|
|
||||||
// Close session if there are no participants connected (RECORDER/STT/BROADCAST
|
// Close session if there are no participants connected (RECORDER/STT/BROADCAST
|
||||||
// do not count) and publishing
|
// do not count) and publishing
|
||||||
log.info("Closing session {} after automatic stop of recording {}",
|
log.info("Closing session {} after automatic stop of recording {}",
|
||||||
|
@ -737,35 +736,38 @@ public class RecordingManager {
|
||||||
ScheduledFuture<?> future = this.automaticRecordingStopThreads.remove(session.getSessionId());
|
ScheduledFuture<?> future = this.automaticRecordingStopThreads.remove(session.getSessionId());
|
||||||
if (future != null) {
|
if (future != null) {
|
||||||
boolean cancelled = future.cancel(false);
|
boolean cancelled = future.cancel(false);
|
||||||
try {
|
if (session.onlyRecorderAndOrSttAndOrBroadcastParticipant()) {
|
||||||
if (session.closingLock.writeLock().tryLock(15, TimeUnit.SECONDS)) {
|
// Close session if there are no participants connected (except for
|
||||||
try {
|
// RECORDER/STT/BROADCAST). This code will only be executed if recording is
|
||||||
if (session.isClosed()) {
|
// manually stopped during the automatic stop timeout, so the session must be
|
||||||
return false;
|
// also closed
|
||||||
}
|
try {
|
||||||
if (session.getParticipants().size() == 0
|
if (session.closingLock.writeLock().tryLock(15, TimeUnit.SECONDS)) {
|
||||||
|| session.onlyRecorderAndOrSttAndOrBroadcastParticipant()) {
|
try {
|
||||||
// Close session if there are no participants connected (except for
|
if (!session.onlyRecorderAndOrSttAndOrBroadcastParticipant()) {
|
||||||
// RECORDER/STT/BROADCAST). This code will only be executed if recording is
|
// Somebody connected after acquiring the lock. Cancel session close up
|
||||||
// manually stopped during the automatic stop timeout, so the session must be
|
return true;
|
||||||
// also closed
|
}
|
||||||
|
if (session.isClosed()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
log.info(
|
log.info(
|
||||||
"Ongoing recording of session {} was explicetly stopped within timeout for automatic recording stop. Closing session",
|
"Ongoing recording of session {} was explicetly stopped within timeout for automatic recording stop. Closing session",
|
||||||
session.getSessionId());
|
session.getSessionId());
|
||||||
sessionManager.closeSessionAndEmptyCollections(session, reason, false);
|
sessionManager.closeSessionAndEmptyCollections(session, reason, false);
|
||||||
|
} finally {
|
||||||
|
session.closingLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
} finally {
|
} else {
|
||||||
session.closingLock.writeLock().unlock();
|
log.error(
|
||||||
|
"Timeout waiting for Session {} closing lock to be available for aborting automatic recording stop thred",
|
||||||
|
session.getSessionId());
|
||||||
}
|
}
|
||||||
} else {
|
} catch (InterruptedException e) {
|
||||||
log.error(
|
log.error(
|
||||||
"Timeout waiting for Session {} closing lock to be available for aborting automatic recording stop thred",
|
"InterruptedException while waiting for Session {} closing lock to be available for aborting automatic recording stop thred",
|
||||||
session.getSessionId());
|
session.getSessionId());
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
|
||||||
log.error(
|
|
||||||
"InterruptedException while waiting for Session {} closing lock to be available for aborting automatic recording stop thred",
|
|
||||||
session.getSessionId());
|
|
||||||
}
|
}
|
||||||
return cancelled;
|
return cancelled;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue