From ec28c5a35d6a846b54312aac16edfddd810de3b5 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 1 Feb 2016 03:58:45 -0500 Subject: [PATCH] Retry S3 requests on 500 or 503 in addition to interruption And adjust S3 success/backoff counters on success --- chrome/content/zotero/xpcom/storage/zfs.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js index 97c7ea088..b2a0dd080 100644 --- a/chrome/content/zotero/xpcom/storage/zfs.js +++ b/chrome/content/zotero/xpcom/storage/zfs.js @@ -869,7 +869,7 @@ Zotero.Sync.Storage.ZFS = (function () { return; } - if (status == 0) { + if (status == 0 || status == 500 || status == 503) { if (_s3ConsecutiveFailures >= _maxS3ConsecutiveFailures) { Zotero.debug(_s3ConsecutiveFailures + " consecutive S3 failures -- aborting", 1); @@ -921,6 +921,13 @@ Zotero.Sync.Storage.ZFS = (function () { Zotero.debug("Finished download of " + destFile.path); + // Decrease backoff delay on successful download + if (_s3Backoff > 1) { + _s3Backoff /= 2; + } + // And reset consecutive failures + _s3ConsecutiveFailures = 0; + try { deferred.resolve(Zotero.Sync.Storage.processDownload(data)); }