rebroadcast: fix inactivity grace period

This commit is contained in:
Koushik Dutta
2022-01-26 09:46:43 -08:00
parent 13b92a8800
commit 6f88ac052d
3 changed files with 6 additions and 4 deletions

View File

@@ -61,6 +61,7 @@ class PrebufferSession {
storage: Storage;
activeClients = 0;
inactivityTimeout: NodeJS.Timeout;
AUDIO_CONFIGURATION = AUDIO_CONFIGURATION_TEMPLATE + '-' + this.streamId;
@@ -380,7 +381,8 @@ class PrebufferSession {
if (this.activeClients)
return;
setTimeout(() => {
clearTimeout(this.inactivityTimeout)
this.inactivityTimeout = setTimeout(() => {
if (this.activeClients)
return;
this.console.log(this.streamName, 'terminating rebroadcast due to inactivity');