Remove timeout for file sync uploads
Regression from50b65b3010
, and a proper fixa9c10309f7
This commit is contained in:
parent
da690a45b1
commit
42d570e623
3 changed files with 8 additions and 27 deletions
|
@ -138,7 +138,8 @@ Zotero.HTTP = new function() {
|
|||
* @param {Number[]|false} [options.successCodes] - HTTP status codes that are considered
|
||||
* successful, or FALSE to allow all
|
||||
* @param {Zotero.CookieSandbox} [options.cookieSandbox] - Cookie sandbox object
|
||||
* @param {Number} [options.timeout = 30000] - Request timeout specified in milliseconds
|
||||
* @param {Number} [options.timeout = 30000] - Request timeout specified in milliseconds, or 0
|
||||
* for no timeout
|
||||
* @param {Number[]} [options.errorDelayIntervals] - Array of milliseconds to wait before
|
||||
* retrying after 5xx error; if unspecified, a default set is used
|
||||
* @param {Number} [options.errorDelayMax = 3600000] - Milliseconds to wait before stopping
|
||||
|
@ -387,7 +388,9 @@ Zotero.HTTP = new function() {
|
|||
}
|
||||
|
||||
// Set timeout
|
||||
xmlhttp.timeout = options.timeout || 30000;
|
||||
if (options.timeout !== 0) {
|
||||
xmlhttp.timeout = options.timeout || 30000;
|
||||
}
|
||||
|
||||
xmlhttp.ontimeout = function() {
|
||||
deferred.reject(new Zotero.HTTP.TimeoutException(options.timeout));
|
||||
|
|
|
@ -558,6 +558,7 @@ Zotero.Sync.Storage.Mode.WebDAV.prototype = {
|
|||
},
|
||||
errorDelayIntervals: this.ERROR_DELAY_INTERVALS,
|
||||
errorDelayMax: this.ERROR_DELAY_MAX,
|
||||
timeout: 0,
|
||||
debug: true
|
||||
}
|
||||
);
|
||||
|
|
|
@ -645,7 +645,8 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = {
|
|||
});
|
||||
},
|
||||
debug: true,
|
||||
successCodes: [201]
|
||||
successCodes: [201],
|
||||
timeout: 0
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -683,30 +684,6 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = {
|
|||
return this._uploadFile(request, item, params);
|
||||
}
|
||||
}
|
||||
// Alternative to the above. There was at least one report of this happening even though
|
||||
// a timeout isn't being set, with 2152398850 (NS_BINDING_ABORTED) from the channel:
|
||||
// https://forums.zotero.org/discussion/79286/
|
||||
else if (e instanceof Zotero.HTTP.TimeoutException) {
|
||||
Zotero.logError(e);
|
||||
if (this._s3ConsecutiveFailures >= this._maxS3ConsecutiveFailures) {
|
||||
Zotero.debug(this._s3ConsecutiveFailures
|
||||
+ " consecutive S3 failures -- aborting", 1);
|
||||
this._s3ConsecutiveFailures = 0;
|
||||
let e = Zotero.getString('sync.storage.error.zfs.restart', Zotero.appName);
|
||||
throw new Error(e);
|
||||
}
|
||||
else {
|
||||
Zotero.logError("S3 timed out (" + item.libraryKey + ") -- retrying upload");
|
||||
if (this._s3Backoff < this._maxS3Backoff) {
|
||||
this._s3Backoff *= 2;
|
||||
}
|
||||
this._s3ConsecutiveFailures++;
|
||||
Zotero.debug("Delaying " + item.libraryKey + " upload for "
|
||||
+ this._s3Backoff + " seconds", 2);
|
||||
yield Zotero.Promise.delay(this._s3Backoff * 1000);
|
||||
return this._uploadFile(request, item, params);
|
||||
}
|
||||
}
|
||||
else if (e.status == 500) {
|
||||
// TODO: localize
|
||||
throw new Error("File upload failed. Please try again.");
|
||||
|
|
Loading…
Reference in a new issue