Missing database connection pooling and WAL checkpoint causes performance degradation
Next step: Evaluate this item to determine if it's worth fixing. Or approve directly if you already know what needs to be done.
Location
src/supervisor/db.py:107
Description
db.py line 107 uses a single SQLite connection with WAL mode, but there's no connection pooling and no WAL checkpoint management. Under heavy write load (many concurrent runs, frequent reports), the WAL file grows unbounded because SQLite only auto-checkpoints at 1000 pages. The Store uses a threading.RLock (line 106) which serializes all database access, creating a bottleneck when multiple API requests hit the database. For a monitoring system that may have dozens of resources on schedules, this will cause: (1) Slow queries as WAL grows, (2) Disk space exhaustion, (3) API timeouts. Should add PRAGMA wal_checkpoint(TRUNCATE) periodically and consider connection pooling or async DB access for FastAPI.
Evaluation
Click "Evaluate with Claude Code" to have an agent analyze this item.