Skip to content

Commit

Permalink
feat(next/api): update failed export task
Browse files Browse the repository at this point in the history
  • Loading branch information
sdjdd committed Mar 26, 2024
1 parent 27dc154 commit 323ac14
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion next/api/src/ticket/export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,17 @@ queue.on('completed', async (job, result) => {
}
});

queue.on('failed', (job, err) => {
queue.on('failed', async (job, err) => {
console.error('[export ticket]:', job.data, err);
const task = await ExportTicketTask.find(job.data.taskId, { useMasterKey: true });
if (task) {
await task.update(
{
status: 'failed',
},
{ useMasterKey: true }
);
}
});

export async function createTicketExportJob(jobData: Omit<JobData, 'date' | 'taskId'>) {
Expand Down

0 comments on commit 323ac14

Please sign in to comment.