diff --git a/api/src/models/Track.js b/api/src/models/Track.js index 1d68260..56797ae 100644 --- a/api/src/models/Track.js +++ b/api/src/models/Track.js @@ -202,7 +202,7 @@ class Track extends mongoose.Model { await this.save(); - return await queue.add( + await queue.add( 'processTrack', { trackId: this._id.toString(), diff --git a/api/src/queue.js b/api/src/queue.js index c7c1af7..9d81775 100644 --- a/api/src/queue.js +++ b/api/src/queue.js @@ -1,5 +1,12 @@ -const Bull = require('bull') +const Bull = require('bull'); -const config = require('./config') +const config = require('./config'); -module.exports = new Bull('processQueue', config.redisUrl) +module.exports = new Bull('processQueue', config.redisUrl, { + settings: { + // if the worker process is killed and restarted, e.g. due to reboot or + // upgrade, it is okay to wait for a timeout on the job and restart it + maxStalledCount: 3, + lockDuration: 120 * 1000, + }, +});