1
0

[loop-cycle-50] refactor: replace bare sqlite3.connect() with context managers batch 2 (#157) (#180)

This commit is contained in:
2026-03-15 11:58:43 -04:00
parent bea2749158
commit bcd6d7e321
16 changed files with 512 additions and 510 deletions

View File

@@ -209,14 +209,11 @@ async def api_swarm_status():
pending_tasks = 0
try:
db = _get_db()
try:
with _get_db() as db:
row = db.execute(
"SELECT COUNT(*) as cnt FROM tasks WHERE status IN ('pending_approval','approved')"
).fetchone()
pending_tasks = row["cnt"] if row else 0
finally:
db.close()
except Exception:
pass