Skip to content

Use a stable per-user path for the default rate-limit bucket#145

Merged
bpepple merged 1 commit into
mainfrom
set-bucket-db-path
Jul 12, 2026
Merged

Use a stable per-user path for the default rate-limit bucket#145
bpepple merged 1 commit into
mainfrom
set-bucket-db-path

Conversation

@bpepple

@bpepple bpepple commented Jul 12, 2026

Copy link
Copy Markdown
Member

Summary

  • The default SQLiteBucket previously 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 (via platformdirs), falling back to a fixed temp-dir path if the cache dir isn't writable (read-only home, restricted container, etc.).
  • Adds platformdirs>=4 as a dependency.

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.
@bpepple bpepple self-assigned this Jul 12, 2026
@bpepple bpepple added the bug Something isn't working label Jul 12, 2026
@bpepple bpepple merged commit 39bb390 into main Jul 12, 2026
11 checks passed
@bpepple bpepple deleted the set-bucket-db-path branch July 12, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant