Merge branch 'release/6.2.0' into develop

pull/6544/head
Chocobozzz 2024-08-06 11:03:54 +02:00
commit 75e7ded018
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 31 additions and 21 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@peertube/peertube-runner", "name": "@peertube/peertube-runner",
"version": "0.0.19", "version": "0.0.20",
"type": "module", "type": "module",
"main": "dist/peertube-runner.js", "main": "dist/peertube-runner.js",
"bin": "dist/peertube-runner.js", "bin": "dist/peertube-runner.js",

View File

@ -277,14 +277,17 @@ export class ProcessLiveRTMPHLSTranscoding {
private async sendPendingChunks (): Promise<any> { private async sendPendingChunks (): Promise<any> {
if (this.ended) return Promise.resolve() if (this.ended) return Promise.resolve()
const promises: Promise<any>[] = [] const parallelPromises: Promise<any>[] = []
for (const playlist of this.pendingChunksPerPlaylist.keys()) { for (const playlist of this.pendingChunksPerPlaylist.keys()) {
let sequentialPromises: Promise<any>
for (const chunk of this.pendingChunksPerPlaylist.get(playlist)) { for (const chunk of this.pendingChunksPerPlaylist.get(playlist)) {
logger.debug(`Sending added live chunk ${chunk} update`) logger.debug(`Sending added live chunk ${chunk} update`)
const videoChunkFilename = basename(chunk) const videoChunkFilename = basename(chunk)
const payloadBuilder = async () => {
let payload: CustomLiveRTMPHLSTranscodingUpdatePayload = { let payload: CustomLiveRTMPHLSTranscodingUpdatePayload = {
type: 'add-chunk', type: 'add-chunk',
videoChunkFilename, videoChunkFilename,
@ -305,13 +308,20 @@ export class ProcessLiveRTMPHLSTranscoding {
} }
} }
promises.push(this.updateWithRetry(payload)) return payload
} }
const p = payloadBuilder().then(p => this.updateWithRetry(p))
if (!sequentialPromises) sequentialPromises = p
else sequentialPromises = sequentialPromises.then(() => p)
}
parallelPromises.push(sequentialPromises)
this.pendingChunksPerPlaylist.set(playlist, []) this.pendingChunksPerPlaylist.set(playlist, [])
} }
await Promise.all(promises) await Promise.all(parallelPromises)
} }
private async updateWithRetry (payload: CustomLiveRTMPHLSTranscodingUpdatePayload, currentTry = 1): Promise<any> { private async updateWithRetry (payload: CustomLiveRTMPHLSTranscodingUpdatePayload, currentTry = 1): Promise<any> {