fix: pre-road audit (Phase 30) — upload-loop OSError, stats lock scope, server int guards

This commit is contained in:
Mathieu Moran
2026-08-15 22:25:17 -04:00
parent 386920b258
commit c6b1384b34
4 changed files with 62 additions and 4 deletions
+3 -1
View File
@@ -504,6 +504,9 @@ def get_overview_stats():
dtc_row = conn.execute(
"SELECT COUNT(*) FROM dtc WHERE IS_SET = 1"
).fetchone()
cumul = conn.execute(
"SELECT COALESCE(SUM(DISTANCE_KM), 0) FROM trips"
).fetchone()
from modules import app_video as _av
try:
video_count = sum(1 for _ in _av.list_local_videos().get("files", []))
@@ -511,7 +514,6 @@ def get_overview_stats():
video_count = 0
from modules import app_settings
base = app_settings._number_value("odometer_baseline", float, 0)
cumul = conn.execute("SELECT COALESCE(SUM(DISTANCE_KM), 0) FROM trips").fetchone()
computed = base + (cumul[0] if cumul else 0)
return {
"trip_count": row[0],
+5 -1
View File
@@ -390,7 +390,11 @@ def _upload_loop():
time.sleep(CATCHUP_INTERVAL)
else:
time.sleep(UPLOAD_INTERVAL)
except (requests.RequestException, app_cellular.CellularError) as e:
except (
requests.RequestException,
app_cellular.CellularError,
OSError,
) as e:
_last_error = str(e)
print(f"Upload failed ({e}), retrying in {backoff}s")
time.sleep(backoff)