timgit / pg-boss

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

Handling Multiple Schedules with the Same Name in PGBoss Without Overwriting #490

Open ssb0498 opened 2 months ago

ssb0498 commented 2 months ago

Hello,

I am implementing a recurring email scheduling feature using the PGBoss library. The user registers schedules to send emails on specific days of the week, and I’m registering multiple schedules using the same schedule name with boss.schedule(name, cronExpression). However, when the same name is used, schedules are overwritten. On the other hand, if I register schedules with different names, it becomes problematic to have multiple boss.work handlers with different names for the same logic, especially since I don’t know how many schedules will be registered.

What I’m looking for is a way to assign a unique identifier to each schedule, even when using the same schedule name, to avoid overwriting and allow selecting and deleting specific schedules by their unique identifiers. Is there a better way to manage schedules uniquely without overwriting?

Thank you!