Skip to content

♻️ refactor(web-api): replace libsql rate limiter with in-memory implementation#1509

Merged
harehare merged 1 commit intomainfrom
refactor/web-api-in-memory-rate-limiter
Mar 28, 2026
Merged

♻️ refactor(web-api): replace libsql rate limiter with in-memory implementation#1509
harehare merged 1 commit intomainfrom
refactor/web-api-in-memory-rate-limiter

Conversation

@harehare
Copy link
Copy Markdown
Owner

Remove deadpool-libsql and libsql dependencies from mq-web-api. Replace the database-backed rate limiter with a pure in-memory HashMap protected by tokio::sync::Mutex, simplifying the implementation and eliminating external database requirements.

…ementation

Remove deadpool-libsql and libsql dependencies from mq-web-api.
Replace the database-backed rate limiter with a pure in-memory
HashMap protected by tokio::sync::Mutex, simplifying the
implementation and eliminating external database requirements.

- Remove database_url, database_auth_token, pool_max_size, and
  pool_timeout_seconds fields from RateLimitConfig
- Replace Pool with Mutex<HashMap<String, RateLimitEntry>> in RateLimiter
- Make RateLimiter::new() synchronous (no I/O setup needed)
- Remove DATABASE_URL, DATABASE_TOKEN, RATE_LIMIT_POOL_MAX_SIZE,
  and RATE_LIMIT_POOL_TIMEOUT_SECONDS env var handling from config
- Update tests to use in-memory helper instead of raw SQL inserts
@harehare harehare merged commit 86ce9a0 into main Mar 28, 2026
6 checks passed
@harehare harehare deleted the refactor/web-api-in-memory-rate-limiter branch March 28, 2026 01:04
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