api: Allow reprocessing of stalled jobs

This commit is contained in:
Paul Bienkowski 2021-04-30 16:05:02 +02:00
parent 23843481c6
commit 44a18657f6
2 changed files with 11 additions and 4 deletions

View file

@ -202,7 +202,7 @@ class Track extends mongoose.Model {
await this.save();
return await queue.add(
await queue.add(
'processTrack',
{
trackId: this._id.toString(),

View file

@ -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,
},
});