[loggi-71e] Replace hand-rolled rate limiter in check_username with Flask-Limiter #119

Closed
opened 2026-02-21 20:40:33 +01:00 by matthias · 0 comments
Owner

Bead ID: loggi-71e
Type: task
Priority: P2
Status: closed
Close reason: Replaced hand-rolled in-memory rate limiter (_username_check_log dict + time.monotonic()) in routes.py check_username() with @limiter.limit('10 per minute') decorator using Flask-Limiter already in use for auth endpoints. Removed ~16 lines of dead code + unused time import. Updated test to use rl_app fixture from test_rate_limit.py. All 172 tests pass.


routes.py check_username() uses a custom in-memory rate limiter (_username_check_log dict + time.monotonic()) but Flask-Limiter is already configured and used in auth.py. The hand-rolled version is fragile (per-process, doesn't work with multiple workers) and creates a redundant pattern. Replace with @limiter.limit() decorator and remove the dead code (~10 lines + unused time import).

**Bead ID:** `loggi-71e` **Type:** task **Priority:** P2 **Status:** closed **Close reason:** Replaced hand-rolled in-memory rate limiter (_username_check_log dict + time.monotonic()) in routes.py check_username() with @limiter.limit('10 per minute') decorator using Flask-Limiter already in use for auth endpoints. Removed ~16 lines of dead code + unused time import. Updated test to use rl_app fixture from test_rate_limit.py. All 172 tests pass. --- routes.py check_username() uses a custom in-memory rate limiter (_username_check_log dict + time.monotonic()) but Flask-Limiter is already configured and used in auth.py. The hand-rolled version is fragile (per-process, doesn't work with multiple workers) and creates a redundant pattern. Replace with @limiter.limit() decorator and remove the dead code (~10 lines + unused time import).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
matthias/loggi#119
No description provided.