]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
End runner live transcoding on update error
authorChocobozzz <me@florianbigard.com>
Mon, 22 May 2023 13:24:19 +0000 (15:24 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 22 May 2023 13:24:19 +0000 (15:24 +0200)
packages/peertube-runner/server/process/shared/process-live.ts

index 6edb1f1e9c116020a99849e0fb3b5d9adbba7437..fae79e4857fb0ba374ed32ffbd1e581c30d0730d 100644 (file)
@@ -248,6 +248,8 @@ export class ProcessLiveRTMPHLSTranscoding {
   private async sendPendingChunks (): Promise<any> {
     if (this.ended) return Promise.resolve()
 
+    const promises: Promise<any>[] = []
+
     for (const playlist of this.pendingChunksPerPlaylist.keys()) {
       for (const chunk of this.pendingChunksPerPlaylist.get(playlist)) {
         logger.debug(`Sending added live chunk ${chunk} update`)
@@ -271,12 +273,13 @@ export class ProcessLiveRTMPHLSTranscoding {
           }
         }
 
-        this.updateWithRetry(payload)
-          .catch(err => logger.error({ err }, 'Cannot update with retry'))
+        promises.push(this.updateWithRetry(payload))
       }
 
       this.pendingChunksPerPlaylist.set(playlist, [])
     }
+
+    await Promise.all(promises)
   }
 
   private async updateWithRetry (payload: LiveRTMPHLSTranscodingUpdatePayload, currentTry = 1): Promise<any> {