Skip to content

Commit

Permalink
fix(core): Correctly calculate job duration for pending/retrying jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Oct 5, 2021
1 parent 2f24a33 commit 73fa278
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/job-queue/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ export class Job<T extends JobData<T> = any> {
}

get duration(): number {
if (this.state === JobState.PENDING || this.state === JobState.RETRYING) {
return 0;
}
const end = this._settledAt || new Date();
return +end - +(this._startedAt || end);
}
Expand Down

0 comments on commit 73fa278

Please sign in to comment.