timgit / pg-boss

Queueing jobs in Postgres from Node.js like a boss
MIT License
2.07k stars 157 forks source link

Calling boss.send() after boss.sendAfter(...DATE) causes it to also send after the DATE instead of immediately #369

Closed pulpdood closed 1 year ago

pulpdood commented 1 year ago

Calling boss.send() immediately after boss.sendAfter(...DATE) causes it to also send after the DATE instead of immediately. I had to add a startAfter to the boss.send() options in order to get it to send immediately. It seems state is somehow leaking between the two sends? Sorry if this issue report isn't up to scratch, I'm not used to opening issues in projects.

E.g.

const job1 = await boss.sendAfter(QUEUE, data, CONFIG, futureDate);
...
const job2 = await boss.send(QUEUE, data2, CONFIG); // <- this will have its startAfter as futureDate instead of immediately
timgit commented 1 year ago

Thanks for reporting. This should be resolved in 8.4.1