From ebfc78ef3a0499cd4d5583b1757e345e675ee8c1 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Thu, 30 Mar 2023 06:30:13 +0000 Subject: [PATCH] More retries on item existence check --- ia-upload-stream | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ia-upload-stream b/ia-upload-stream index a0a2d76..d6b01b6 100755 --- a/ia-upload-stream +++ b/ia-upload-stream @@ -251,7 +251,8 @@ def upload(item, filename, metadata, *, iaConfigFile = None, partSize = 100*1024 logger.info(f'Got upload ID {uploadId}') # Wait for the item to exist; if the above created the item, it takes a little while for IA to actually create the bucket, and uploads would fail with a 404 until then. - for attempt in range(1, tries + 1): + # Use twice the normal amount of retries because it frequently breaks... + for attempt in range(1, 2 * tries + 1): logger.info(f'Checking for existence of {item}') r = requests.get(f'https://s3.us.archive.org/{item}/', headers = headers, timeout = TIMEOUT) if r.status_code == 200: