Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.save(async (err, $job) => { // See: https://github.com/bee-queue/bee-queue/issues/147
if (err) {
console.error(`@@adonisjs/Queue: failed in creating job id=${this._jobUuid} on queue: ${_name}`)
// Known error when redis has not all lua scripts loaded properly
if (err.command === 'EVALSHA') {
await bqScripts.buildCache(this.getByName(_name))
console.info(`@@adonisjs/Queue: successfully reloaded Lua scripts into cache; retrying job creation id=${this._jobUuid}`)
// try to create job again
try {
await queue.removeJob(this._jobUuid)
} catch (ex) { $job = null } finally {
_job = $job || queue.createJob(job.makeArg(job))
_job.setId(this._jobUuid)
.timeout(job.timeOut || 0)
.backoff('fixed', job.retryUntil || 0)
.retries(job.retryCount || 2)
.delayUntil(job.delayUntil || 0)
.save()
}
}