Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async run ({params}) {
let failed = await api.tasks.failed(params.id, params.id)
if (!failed) { throw new Error('failed job not found') }
await api.tasks.retryAndRemoveFailed(failed[0])
}
}
async run ({response}) {
response.resqueDetails = await api.tasks.details()
}
}
async run ({params}) {
let failed = await api.tasks.failed(params.id, params.id)
if (!failed) { throw Error('failed job not found') }
await api.tasks.removeFailed(failed[0])
}
}
async run ({response, params}) {
response.count = await api.tasks.delLock(params.lock)
}
}
async run ({response, params}) {
let timestamps = []
let delayedjobs = {}
response.timestampsCount = 0
let allTimestamps = await api.tasks.timestamps()
if (allTimestamps.lenght === 0) { return }
response.timestampsCount = allTimestamps.length
for (let i = 0; i < allTimestamps.length; i++) {
if (i >= params.start && i <= params.stop) { timestamps.push(allTimestamps[i]) }
}
for (let j in timestamps) {
let timestamp = timestamps[j]
delayedjobs[timestamp] = await api.tasks.delayedAt(timestamp)
}
response.delayedjobs = delayedjobs
}
}
async run ({params, response}) {
response.queueLength = await api.resque.queue.length(params.queue)
response.jobs = await api.tasks.queued(params.queue, params.start, params.stop)
}
}
async run ({response}) {
response.workerQueues = await api.tasks.workers()
}
}
async run ({response}) {
response.locks = await api.tasks.locks()
}
}
async run ({response, params}) {
response.deleted = await api.tasks.delQueue(params.queue)
}
}
async run () {
let failed = await api.tasks.failed(0, 0)
if (failed && failed.length > 0) {
let failedJob = failed[0]
await api.tasks.retryAndRemoveFailed(failedJob)
return this.run()
}
}
}