Skip to content
Discussion options

You must be logged in to vote

Hi there, thanks for the follow-up! You can embed pgqueuer in your main app to drive background tasks, but it’s worth considering resource isolation: if your queue work suddenly spikes, it could consume CPUs or I/O and starve your primary application threads or event loop. To mitigate this you can:

  • Cap concurrency at the entrypoint level using concurrency_limit on the decorator. For example:

    @pgq.entrypoint("my_task", concurrency_limit=5)
    async def my_task(job):
        …

This ensures no more than five instances run in parallel . .

  • Bound total workers via the max_concurrent_tasks parameter on PgQueuer.run():
    await PgQueuer(pool_driver).run(max_concurrent_tasks=20)

which caps simultaneo…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by takeda
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants