Remove redundant error handling in Z.Sync.Data.Engine::_uploadObjects()
makeRequest() now retries 5xx errors automatically, so it's not necessary higher up.
This commit is contained in:
parent
4cc6408105
commit
a0c7cf9bee
1 changed files with 101 additions and 126 deletions
|
@ -835,7 +835,6 @@ Zotero.Sync.Data.Engine.prototype._uploadObjects = Zotero.Promise.coroutine(func
|
|||
|
||||
let results;
|
||||
let numSuccessful = 0;
|
||||
try {
|
||||
({ libraryVersion, results } = yield this.apiClient.uploadObjects(
|
||||
this.library.libraryType,
|
||||
this.libraryTypeID,
|
||||
|
@ -945,31 +944,7 @@ Zotero.Sync.Data.Engine.prototype._uploadObjects = Zotero.Promise.coroutine(func
|
|||
}
|
||||
}
|
||||
Zotero.debug("Failed: " + numFailed, 2);
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Zotero.HTTP.UnexpectedStatusException) {
|
||||
if (e.status == 412) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
// On 5xx, delay and retry
|
||||
if (e.status >= 500 && e.status <= 600) {
|
||||
if (!failureDelayGenerator) {
|
||||
// Keep trying for up to an hour
|
||||
failureDelayGenerator = Zotero.Utilities.Internal.delayGenerator(
|
||||
Zotero.Sync.Data.failureDelayIntervals, 60 * 60 * 1000
|
||||
);
|
||||
}
|
||||
let keepGoing = yield failureDelayGenerator.next();
|
||||
if (!keepGoing) {
|
||||
Zotero.logError("Failed too many times");
|
||||
throw e;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
// If we didn't make any progress, bail
|
||||
if (!numSuccessful) {
|
||||
throw new Error("Made no progress during upload -- stopping");
|
||||
|
|
Loading…
Reference in a new issue