Skip to content

Commit

Permalink
Fix transcoding queue on error state (#615)
Browse files Browse the repository at this point in the history
* Fix transcoding queue on error state

* Lint
  • Loading branch information
raymondjacobson committed Jul 6, 2020
1 parent 1cfc3a6 commit 01428d8
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions creator-node/src/TranscodingQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,38 @@ class TranscodingQueue {
this.queue.process(PROCESS_NAMES.segment, MAX_CONCURRENCY, async (job, done) => {
const { fileDir, fileName, logContext } = job.data

this.logStatus(logContext, `segmenting ${fileDir} ${fileName}`)

const filePaths = await ffmpeg.segmentFile(
fileDir,
fileName,
{ logContext }
)
done(null, { filePaths })
try {
this.logStatus(logContext, `segmenting ${fileDir} ${fileName}`)

const filePaths = await ffmpeg.segmentFile(
fileDir,
fileName,
{ logContext }
)

done(null, { filePaths })
} catch (e) {
this.logStatus(logContext, `Error ${e}`)
done(e)
}
})

this.queue.process(PROCESS_NAMES.transcode320, /* inherited */ 0, async (job, done) => {
const { fileDir, fileName, logContext } = job.data

this.logStatus(logContext, `transcoding to 320kbps ${fileDir} ${fileName}`)
try {
this.logStatus(logContext, `transcoding to 320kbps ${fileDir} ${fileName}`)

const filePath = await ffmpeg.transcodeFileTo320(
fileDir,
fileName,
{ logContext }
)
done(null, { filePath })
const filePath = await ffmpeg.transcodeFileTo320(
fileDir,
fileName,
{ logContext }
)
done(null, { filePath })
} catch (e) {
this.logStatus(logContext, `Error ${e}`)
done(e)
}
})

this.logStatus = this.logStatus.bind(this)
Expand Down

0 comments on commit 01428d8

Please sign in to comment.