try fix event.controller
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import type { Job } from 'bullmq';
|
||||
import type { Queue } from 'bullmq';
|
||||
|
||||
export function findJobByPrefix<T>(
|
||||
jobs: Job<T, any, string>[],
|
||||
prefix: string
|
||||
import { redis } from '../../redis';
|
||||
|
||||
export async function findJobByPrefix<T>(
|
||||
queue: Queue<T, any, string>,
|
||||
matcher: string
|
||||
) {
|
||||
return jobs.find((job) => job.opts.jobId?.startsWith(prefix));
|
||||
const prefix = `bull:${queue.name}:`;
|
||||
const keys = await redis.keys(`${prefix}${matcher}*`);
|
||||
const key = keys.findLast((key) => !key.endsWith(':logs'));
|
||||
return key ? await queue.getJob(key.replace(prefix, '')) : undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user