Skip to content

Commit 7a8a5bf

Browse files
committed
fix: allow returing details for status
1 parent 3160f0d commit 7a8a5bf

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/JobProcessor.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ export class JobProcessor {
2121
| undefined;
2222
} = {};
2323

24-
async getStatus() {
24+
async getStatus(fullDetails = false) {
2525
return {
2626
queueSize: await this.agenda.db.getQueueSize(),
2727
jobStatus: this.jobStatus,
28-
runningJobs: this.runningJobs.length,
29-
lockedJobs: this.lockedJobs.length,
30-
jobsToLock: this.jobsToLock.length,
28+
runningJobs: !fullDetails ? this.runningJobs.length : this.runningJobs,
29+
lockedJobs: !fullDetails ? this.lockedJobs.length : this.lockedJobs,
30+
jobsToLock: !fullDetails ? this.jobsToLock.length : this.jobsToLock,
3131
isLockingOnTheFly: this.isLockingOnTheFly
3232
};
3333
}

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ export class Agenda extends EventEmitter {
4949

5050
private ready: Promise<void>;
5151

52-
getRunningStats() {
52+
getRunningStats(fullDetails = false) {
5353
if (!this.jobProcessor) {
5454
throw new Error('agenda not running!');
5555
}
56-
return this.jobProcessor.getStatus();
56+
return this.jobProcessor.getStatus(fullDetails);
5757
}
5858

5959
constructor(

0 commit comments

Comments
 (0)