Clean
This commit is contained in:
parent
e648503e4f
commit
caf142f1db
|
@ -68,23 +68,19 @@ class InMemoryQueue implements Partial<Queue> {
|
||||||
*/
|
*/
|
||||||
async process(func: any) {
|
async process(func: any) {
|
||||||
this._emitter.on("message", async () => {
|
this._emitter.on("message", async () => {
|
||||||
try {
|
if (this._messages.length <= 0) {
|
||||||
if (this._messages.length <= 0) {
|
return
|
||||||
return
|
}
|
||||||
}
|
let msg = this._messages.shift()
|
||||||
let msg = this._messages.shift()
|
|
||||||
|
|
||||||
let resp = func(msg)
|
let resp = func(msg)
|
||||||
if (resp.then != null) {
|
if (resp.then != null) {
|
||||||
await resp
|
await resp
|
||||||
}
|
}
|
||||||
this._runCount++
|
this._runCount++
|
||||||
const jobId = msg?.opts?.jobId?.toString()
|
const jobId = msg?.opts?.jobId?.toString()
|
||||||
if (jobId && msg?.opts?.removeOnComplete) {
|
if (jobId && msg?.opts?.removeOnComplete) {
|
||||||
this._queuedJobIds.delete(jobId)
|
this._queuedJobIds.delete(jobId)
|
||||||
}
|
|
||||||
} catch (e: any) {
|
|
||||||
throw e
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue