Keep authentication database writes off the event loop #311

Closed
opened 2026-08-08 14:50:42 +00:00 by timmy · 0 comments
Owner

Problem

The async sign-in and single-device sign-out routes perform synchronous SQLite operations for throttling, session activation, and revocation. Under lock contention, these waits can stall unrelated live-dashboard requests. Session validation and all-device revocation already use worker threads, but the remaining authentication write path does not.

Acceptance criteria

  • Slow login-attempt lookup, failure recording, and clearing do not block an event-loop heartbeat.
  • Slow session activation and single-session revocation do not block unrelated async work.
  • Existing 401/429 behavior, secure cookie timing, and privacy-safe 503 failure responses remain unchanged.
  • Focused authentication tests and the full suite pass.

Non-duplication evidence

#275 covered session validation reads only; #270 introduced throttling. Current src/main.py still calls these SQLite-backed operations synchronously. No open issue covers the remaining authentication write path.

## Problem The async sign-in and single-device sign-out routes perform synchronous SQLite operations for throttling, session activation, and revocation. Under lock contention, these waits can stall unrelated live-dashboard requests. Session validation and all-device revocation already use worker threads, but the remaining authentication write path does not. ## Acceptance criteria - Slow login-attempt lookup, failure recording, and clearing do not block an event-loop heartbeat. - Slow session activation and single-session revocation do not block unrelated async work. - Existing 401/429 behavior, secure cookie timing, and privacy-safe 503 failure responses remain unchanged. - Focused authentication tests and the full suite pass. ## Non-duplication evidence #275 covered session validation reads only; #270 introduced throttling. Current `src/main.py` still calls these SQLite-backed operations synchronously. No open issue covers the remaining authentication write path.
timmy self-assigned this 2026-08-08 14:50:42 +00:00
timmy closed this issue 2026-08-08 14:58:00 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
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: stackchain/stackchain-dashboard#311
No description provided.