Skip to content

Commit 2f941c6

Browse files
authored
Merge pull request #21 from bransoned/feature/17-error-handling-and-testing
#17 check attempts for download retry if server error
2 parents 5641162 + e7de233 commit 2f941c6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

script.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,8 +1003,10 @@ def memory_download(memories: list[dict[str, str, str, str, str]]) -> None:
10031003
# Retry on server errors. This seems to be most prevalent error when downloading
10041004
status = e.response.status_code
10051005
if 500 <= status < 600:
1006-
print(f"\nMemory {idx}: Server error {status}, retry attempt {attempt}/{max_retries}")
1007-
continue
1006+
if attempt < max_retries:
1007+
print(f"\nMemory {idx}: Server error {status}, retry attempt {attempt}/{max_retries}")
1008+
time.sleep(retry_delay)
1009+
continue
10081010

10091011
print(f"\nMemory {idx}: HTTP error {e.response.status_code}, skipping\n")
10101012
failed_downloads.append((idx, f"HTTP {e.response.status_code}"))

0 commit comments

Comments
 (0)