lazyflat/web
EiSiMo 617c76cb54 db: thread-local SQLite connections + busy_timeout
The module-level _conn was being hit from FastAPI handlers, the retention
daemon thread, and asyncio.to_thread workers simultaneously. Sharing a
single sqlite3.Connection across threads is unsafe (cursors collide)
even with check_same_thread=False and WAL. The writer _lock didn't cover
readers, so a reader cursor could race a writer mid-statement.

Switch to threading.local(): each thread gets its own Connection via
_get_conn(). WAL handles concurrent readers/writer at the DB level;
busy_timeout=5000 absorbs short-lived "database is locked" when two
threads both try to BEGIN IMMEDIATE. The write-serialising _lock stays
— it keeps multi-statement writer blocks atomic and avoids busy-loop on
concurrent writers.

External access via db._conn replaced with a new db.has_running_application
helper (the only caller outside db.py).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 19:01:27 +02:00
..
static rename to wohnungsdidi + didi logo + footer for all + seconds-only counter 2026-04-21 17:29:24 +02:00
templates wohnungen actions: keep label text, disable both buttons while running 2026-04-21 18:43:17 +02:00
app.py db: thread-local SQLite connections + busy_timeout 2026-04-21 19:01:27 +02:00
apply_client.py multi-user: users, per-user profiles/filters/notifications, tab UI, apply forensics 2026-04-21 10:52:41 +02:00
auth.py multi-user: users, per-user profiles/filters/notifications, tab UI, apply forensics 2026-04-21 10:52:41 +02:00
db.py db: thread-local SQLite connections + busy_timeout 2026-04-21 19:01:27 +02:00
Dockerfile lazyflat: combined alert + apply behind authenticated web UI 2026-04-21 09:51:35 +02:00
enrichment.py rename to wohnungsdidi + didi logo + footer for all + seconds-only counter 2026-04-21 17:29:24 +02:00
llm.py secrets tab, drop commute filter, favicon, robust error reports 2026-04-21 17:56:57 +02:00
matching.py multi-user: users, per-user profiles/filters/notifications, tab UI, apply forensics 2026-04-21 10:52:41 +02:00
notifications.py rename to wohnungsdidi + didi logo + footer for all + seconds-only counter 2026-04-21 17:29:24 +02:00
requirements.txt enrichment: drop LLM for structured info, dedup images by sha + phash 2026-04-21 15:29:55 +02:00
retention.py multi-user: users, per-user profiles/filters/notifications, tab UI, apply forensics 2026-04-21 10:52:41 +02:00
settings.py rename to wohnungsdidi + didi logo + footer for all + seconds-only counter 2026-04-21 17:29:24 +02:00