merge: Fix occasional API errors caused by null jobs (!1179)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1179 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
commit
e46c3f14fa
1 changed files with 4 additions and 2 deletions
|
|
@ -879,7 +879,7 @@ export class QueueService {
|
|||
public async queueGetJobs(queueType: typeof QUEUE_TYPES[number], jobTypes: JobType[], search?: string) {
|
||||
const RETURN_LIMIT = 100;
|
||||
const queue = this.getQueue(queueType);
|
||||
let jobs: Bull.Job[];
|
||||
let jobs: (Bull.Job | null)[];
|
||||
|
||||
if (search) {
|
||||
jobs = await queue.getJobs(jobTypes, 0, 1000);
|
||||
|
|
@ -896,7 +896,9 @@ export class QueueService {
|
|||
jobs = await queue.getJobs(jobTypes, 0, RETURN_LIMIT);
|
||||
}
|
||||
|
||||
return jobs.map(job => this.packJobData(job));
|
||||
return jobs
|
||||
.filter(job => job != null) // not sure how this happens, but it does
|
||||
.map(job => this.packJobData(job));
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue