Skip to content

Ordered processing by key #334

Answered by timgit
tpodom asked this question in Q&A
Jul 8, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

I'm assuming in your question that you want concurrency as high as possible, but only one worker per key. This can't be achieved in pg-boss in isolation (yet).

One option I think could work that has a fairly low performance impact would be adding a new unique constraint (singletonKey WHERE state='active') and then add an ON CONFLICT (singletonKey) DO NOTHING in the fetch command's update to fail gracefully when attempting to put the second job into active state.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tpodom
Comment options

@timgit
Comment options

Answer selected by tpodom
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