From 6235fdee06c2ba3c04e6998e7319242b8bed319d Mon Sep 17 00:00:00 2001 From: Nick Bradley Date: Tue, 14 Feb 2017 21:33:17 -0800 Subject: [PATCH] check if queue initialized before attempting to get job counts --- src/model/JobQueue.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/model/JobQueue.ts b/src/model/JobQueue.ts index 864c526..665ac83 100644 --- a/src/model/JobQueue.ts +++ b/src/model/JobQueue.ts @@ -114,6 +114,9 @@ export class JobQueue { } public async getJob(id: string): Promise { + if (!this.initialized) { + await this.init(); + } return >this.queue.getJob(id); } @@ -126,6 +129,9 @@ export class JobQueue { // WARNING: using private methods from bull! public async stats() { + if (!this.initialized) { + await this.init(); + } let promises: Promise[] = []; return new Promise((fulfill, reject) => { promises.push(this.queue.getCompletedCount());