timgit / pg-boss

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

queue maintenance with serverless workers #382

Closed guy-borderless closed 3 months ago

guy-borderless commented 1 year ago

If I offload job handling to serverless functions that take work via fetch(). How do I run queue maintenance periodically, preferably without creating a non-serverless queue worker? Is this scenario supported?

timgit commented 1 year ago

Running start() will automatically run maintenance unless you've opted out of this. If so, you may want to create a dedicated function that runs on a cron and stays alive long enough to handle maintenance. You also won't have reliable scheduling if you don't keep a supervisor process running

guy-borderless commented 1 year ago

Would you consider a PR that would allow a "serverless mode" to the queue (I'm currently using qstash)? something like a function that can be called periodically to run maintenance, set schedules, and ping the URLs of the job handlers according to the number of open jobs

timgit commented 1 year ago

Yes! Thanks

timgit commented 3 months ago

This is supported now in v10