Skip to content

Commit

Permalink
fix: allow returing details for status
Browse files Browse the repository at this point in the history
  • Loading branch information
simllll committed Oct 13, 2020
1 parent 3160f0d commit 7a8a5bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/JobProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export class JobProcessor {
| undefined;
} = {};

async getStatus() {
async getStatus(fullDetails = false) {
return {
queueSize: await this.agenda.db.getQueueSize(),
jobStatus: this.jobStatus,
runningJobs: this.runningJobs.length,
lockedJobs: this.lockedJobs.length,
jobsToLock: this.jobsToLock.length,
runningJobs: !fullDetails ? this.runningJobs.length : this.runningJobs,
lockedJobs: !fullDetails ? this.lockedJobs.length : this.lockedJobs,
jobsToLock: !fullDetails ? this.jobsToLock.length : this.jobsToLock,
isLockingOnTheFly: this.isLockingOnTheFly
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export class Agenda extends EventEmitter {

private ready: Promise<void>;

getRunningStats() {
getRunningStats(fullDetails = false) {
if (!this.jobProcessor) {
throw new Error('agenda not running!');
}
return this.jobProcessor.getStatus();
return this.jobProcessor.getStatus(fullDetails);
}

constructor(
Expand Down

0 comments on commit 7a8a5bf

Please sign in to comment.