Restore: login retry, skip processed scans, no-retry on 404, started_at tracking

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-12 21:45:52 -04:00
co-authored by Cursor
parent 0cd7243c8d
commit e3f0c07119
3 changed files with 63 additions and 5 deletions
+5 -1
View File
@@ -14,6 +14,7 @@ from bs4 import BeautifulSoup
from spruce.download_result import (
OK,
PERMANENT_MISSING,
UNKNOWN,
DownloadResult,
classify_http_error,
@@ -263,6 +264,10 @@ class MachineSession:
and exc.response is not None
):
sc = exc.response.status_code
cl = classify_http_error(sc, exc)
if cl == PERMANENT_MISSING:
# 404/410 will never succeed — don't waste time retrying.
return DownloadResult(0, sc, str(exc), cl)
if attempt < retries:
log.warning(
"Attempt %d/%d failed %s: %s — retrying in %.0fs",
@@ -281,7 +286,6 @@ class MachineSession:
url,
exc,
)
cl = classify_http_error(sc, exc)
return DownloadResult(0, sc, str(exc), cl)
return DownloadResult(0, None, "download_file: exhausted", UNKNOWN)