fix(device-daemon): recover interrupted uploads, fix wake race, and filter ignored subdirs

This commit is contained in:
2026-11-18 08:08:53 -05:00
parent da4d963919
commit c6a672f25b
5 changed files with 315 additions and 41 deletions

View File

@@ -211,6 +211,19 @@ class SyncStore:
)
self._conn.commit()
def recover_interrupted_uploads(self) -> int:
"""Reset stale UPLOADING rows back to PENDING after an unclean restart."""
with self._lock:
cur = self._conn.execute(
"""
UPDATE files
SET status = 'PENDING'
WHERE status = 'UPLOADING'
"""
)
self._conn.commit()
return cur.rowcount
def mark_synced(self, file_id: int) -> None:
"""Mark a file as SYNCED and clear any prior error."""
now_ms = _now_ms()