Skip to content

Commit

Permalink
fix: get counts of all statuses, to be aligned with Bull
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Mar 28, 2024
1 parent 95f7cfa commit 5a71520
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/api/src/handlers/queues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function getAppQueues(
!isActiveQueue || query.status === 'latest' ? jobStatuses : [query.status as JobStatus];
const currentPage = +query.page || 1;

const counts = await queue.getJobCounts(...jobStatuses);
const counts = await queue.getJobCounts();
const isPaused = await queue.isPaused();

const pagination = getPagination(status, counts, currentPage, jobsPerPage);
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/queueAdapters/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export abstract class BaseAdapter {

public abstract getJob(id: string): Promise<QueueJob | undefined | null>;

public abstract getJobCounts(...jobStatuses: JobStatus[]): Promise<JobCounts>;
public abstract getJobCounts(): Promise<JobCounts>;

public abstract getJobs(
jobStatuses: JobStatus[],
Expand Down
3 changes: 1 addition & 2 deletions packages/api/src/queueAdapters/bull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ export class BullAdapter extends BaseAdapter {
return this.queue.getJobs(jobStatuses, start, end).then((jobs) => jobs.map(this.alignJobData));
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getJobCounts(..._jobStatuses: JobStatus<'bull'>[]): Promise<JobCounts> {
public getJobCounts(): Promise<JobCounts> {
return this.queue.getJobCounts() as unknown as Promise<JobCounts>;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/queueAdapters/bullMQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export class BullMQAdapter extends BaseAdapter {
return this.queue.getJobs(jobStatuses, start, end);
}

public getJobCounts(...jobStatuses: JobStatus[]): Promise<JobCounts> {
return this.queue.getJobCounts(...jobStatuses) as unknown as Promise<JobCounts>;
public getJobCounts(): Promise<JobCounts> {
return this.queue.getJobCounts() as unknown as Promise<JobCounts>;
}

public getJobLogs(id: string): Promise<string[]> {
Expand Down

0 comments on commit 5a71520

Please sign in to comment.