diff --git a/storage/framework/core/queue/src/process.ts b/storage/framework/core/queue/src/process.ts index 6f8346d36..c63e0fe31 100644 --- a/storage/framework/core/queue/src/process.ts +++ b/storage/framework/core/queue/src/process.ts @@ -9,6 +9,7 @@ interface QueuePayload { maxTries: number timeOut: number | null timeOutAt: Date | null + payload: any } export async function processJobs(queue: string | undefined): Promise> { @@ -36,26 +37,26 @@ async function executeJobs(queue: string | undefined): Promise { if (job.available_at && job.available_at > timestampNow()) continue - const payload: QueuePayload = JSON.parse(job.payload) + const body: QueuePayload = JSON.parse(job.payload) const currentAttempts = job.attempts || 0 - log.info(`Running job: ${payload.displayName}`) + log.info(`Running job: ${body.displayName}`) await updateJobAttempts(job, currentAttempts) try { - await runJob(payload.name, { + await runJob(body.name, { queue: job.queue, - payload: {}, + payload: body.payload, context: '', - maxTries: payload.maxTries, + maxTries: body.maxTries, timeout: 60, }) await job.delete() - log.info(`Successfully ran job: ${payload.displayName}`) + log.info(`Successfully ran job: ${body.displayName}`) } catch (error) { - log.error(`Job failed: ${payload.displayName}`, error) + log.error(`Job failed: ${body.displayName}`, error) } } } diff --git a/storage/framework/core/queue/src/utils.ts b/storage/framework/core/queue/src/utils.ts index 285eed83f..1c0aa7b04 100644 --- a/storage/framework/core/queue/src/utils.ts +++ b/storage/framework/core/queue/src/utils.ts @@ -13,6 +13,7 @@ export async function storeJob(name: string, options: QueueOption): Promise