Use a stable per-user path for the default rate-limit bucket#145
Merged
Conversation
Previously the default SQLiteBucket relied on pyrate_limiter's own timestamped temp file, giving each process its own private 20/minute allowance instead of a shared budget. Resolve the bucket path via platformdirs' user cache dir (with a fixed temp-dir fallback) so all processes on a host agree on the same rate-limit budget.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SQLiteBucketpreviously relied on pyrate_limiter's own timestamped temp file, which gives each process its own private 20/minute allowance instead of one shared budget — letting combined traffic from multiple processes exceed Metron's actual server-side rate limit._default_bucket_db_path()now resolves to a stable path under the platform's per-user cache dir (viaplatformdirs), falling back to a fixed temp-dir path if the cache dir isn't writable (read-only home, restricted container, etc.).platformdirs>=4as a dependency.