timgit / pg-boss

Queueing jobs in Node.js using PostgreSQL like a boss
MIT License
1.79k stars 149 forks source link

queue maintenance with serverless workers #382

Open guy-borderless opened 1 year 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