Skip to content

Preserve shared throttle buckets across decorator recreation - #390

Open
Sarbajit-Sengupta wants to merge 1 commit into
grantjenks:masterfrom
Sarbajit-Sengupta:fix/preserve-throttle-bucket
Open

Sarbajit-Sengupta wants to merge 1 commit into
grantjenks:masterfrom
Sarbajit-Sengupta:fix/preserve-throttle-bucket

Conversation

@Sarbajit-Sengupta

Copy link
Copy Markdown

Recreating a named throttle decorator overwrites its persisted token bucket. Starting another worker against the same cache therefore restores the full allowance even when the existing worker has just exhausted it.

Initialize the bucket with atomic Cache.add so an existing bucket survives decorator construction. Two deterministic tests exercise a reused connection and an independently opened connection to the same directory, then verify the next call waits for the shared allowance.

Validation: both regressions fail before the change; 181 core/Fanout/Deque/Index/recipe tests pass on Python 3.13. Blue's formatter API and equivalent Ruff style checks pass. Django integration tests were not run because the dependency download repeatedly reset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant