aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-22 15:24:19 +0200
committerChocobozzz <me@florianbigard.com>2023-05-22 15:24:19 +0200
commitfa3da7a623fdb25be52ebff14e066a99ea9fb0cf (patch)
tree69a0d018243a12ecb2c1bf5995fb6a3807f61433
parent6a9b3151822461a85bbc72b7a50e12ffb69bec3a (diff)
downloadPeerTube-fa3da7a623fdb25be52ebff14e066a99ea9fb0cf.tar.gz
PeerTube-fa3da7a623fdb25be52ebff14e066a99ea9fb0cf.tar.zst
PeerTube-fa3da7a623fdb25be52ebff14e066a99ea9fb0cf.zip
End runner live transcoding on update error
-rw-r--r--packages/peertube-runner/server/process/shared/process-live.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/peertube-runner/server/process/shared/process-live.ts b/packages/peertube-runner/server/process/shared/process-live.ts
index 6edb1f1e9..fae79e485 100644
--- a/packages/peertube-runner/server/process/shared/process-live.ts
+++ b/packages/peertube-runner/server/process/shared/process-live.ts
@@ -248,6 +248,8 @@ export class ProcessLiveRTMPHLSTranscoding {
248 private async sendPendingChunks (): Promise<any> { 248 private async sendPendingChunks (): Promise<any> {
249 if (this.ended) return Promise.resolve() 249 if (this.ended) return Promise.resolve()
250 250
251 const promises: Promise<any>[] = []
252
251 for (const playlist of this.pendingChunksPerPlaylist.keys()) { 253 for (const playlist of this.pendingChunksPerPlaylist.keys()) {
252 for (const chunk of this.pendingChunksPerPlaylist.get(playlist)) { 254 for (const chunk of this.pendingChunksPerPlaylist.get(playlist)) {
253 logger.debug(`Sending added live chunk ${chunk} update`) 255 logger.debug(`Sending added live chunk ${chunk} update`)
@@ -271,12 +273,13 @@ export class ProcessLiveRTMPHLSTranscoding {
271 } 273 }
272 } 274 }
273 275
274 this.updateWithRetry(payload) 276 promises.push(this.updateWithRetry(payload))
275 .catch(err => logger.error({ err }, 'Cannot update with retry'))
276 } 277 }
277 278
278 this.pendingChunksPerPlaylist.set(playlist, []) 279 this.pendingChunksPerPlaylist.set(playlist, [])
279 } 280 }
281
282 await Promise.all(promises)
280 } 283 }
281 284
282 private async updateWithRetry (payload: LiveRTMPHLSTranscodingUpdatePayload, currentTry = 1): Promise<any> { 285 private async updateWithRetry (payload: LiveRTMPHLSTranscodingUpdatePayload, currentTry = 1): Promise<any> {