Menu

1 / 5

Per-account task concurrency without a lock service

DEV Community·codelluis·6 months ago
#Y4HgQPdx
#scenario#how#python#distributedsystems#calls
Reading 0:00
15s threshold

Many background jobs call an external system on behalf of separate accounts,

tenants, or installations. The external system allows parallel calls across

different accounts, but it does not allow two calls for the same account to

run at the same time.

That is not a global rate limit. It is concurrency by key: the key might be

account_id , tenant_id , or another argument that identifies the shared

quota or state boundary.

You want the worker pool busy across many accounts, while each account stays

serial. Without that guard, two workers eventually pick up work for the same

account in parallel. The external system may throttle the account, reject the

second call, or leave you with a partial update to reconcile.

The usual fixes are external locks, one queue per account, or retry/backoff

logic around every call.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.