You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey! My project uses prisma and this looked pretty convenient so I wanted to give it a shot.
I'm facing an issue where the worker is getting stuck in an infinite loop. As soon as I add a job, it prints out an infinite amount of:
2024-06-14T06:50:14.123Z prisma-queue processing job from queue named="email"...
2024-06-14T06:50:14.123Z prisma-queue dequeuing from queue named="email"...
2024-06-14T06:50:14.124Z prisma-queue no jobs found in queue named="email"
2024-06-14T06:50:14.174Z prisma-queue processing job from queue named="email"...
2024-06-14T06:50:14.174Z prisma-queue dequeuing from queue named="email"...
2024-06-14T06:50:14.175Z prisma-queue no jobs found in queue named="email"
I noticed that in the DB, the job is not being removed. NOTE: I'm not awaiting the .start()
Code:
export const emailQueue = createQueue<JobPayload, JobResult>(
{ name: 'email' },
async (job, client) => {
const { id, payload } = job;
console.log(
`Processing job#${id} with payload=${JSON.stringify(payload)})`,
);
// await someAsyncMethod();
await job.progress(50);
const status = 200;
if (Math.random() > 0.5) {
throw new Error(`Failed for some unknown reason`);
}
console.log(`Finished job#${id} with status=${status}`);
return { status };
},
);
void emailQueue.start();
My use case is I'm running Next.js in a container and just want this to run in the background. So I just put the void emailQueue.start() so that it does it in the background. This strategy seems to work with pgboss
The text was updated successfully, but these errors were encountered:
When using pgboss do you await boss.work()? Looks like the process is killed and respawned very quickly and do not have time to actually process the job, you should await queue.start() when using prisma queue (which is basically the equivalent of boss.work).
Hey! My project uses prisma and this looked pretty convenient so I wanted to give it a shot.
I'm facing an issue where the worker is getting stuck in an infinite loop. As soon as I add a job, it prints out an infinite amount of:
I noticed that in the DB, the job is not being removed. NOTE: I'm not
awaiting
the.start()
Code:
My use case is I'm running Next.js in a container and just want this to run in the background. So I just put the
void emailQueue.start()
so that it does it in the background. This strategy seems to work with pgbossThe text was updated successfully, but these errors were encountered: