Skip to content

Commit

Permalink
check if queue initialized before attempting to get job counts
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbradley committed Feb 15, 2017
1 parent fbb953d commit 6235fde
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/model/JobQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ export class JobQueue {
}

public async getJob(id: string): Promise<Job> {
if (!this.initialized) {
await this.init();
}
return <Promise<Job>>this.queue.getJob(id);
}

Expand All @@ -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<number>[] = [];
return new Promise((fulfill, reject) => {
promises.push(this.queue.getCompletedCount());
Expand Down

0 comments on commit 6235fde

Please sign in to comment.