Decrease batch size and increase HTTP timeout for sync uploads

Some write requests are taking > 30 seconds
This commit is contained in:
Dan Stillman 2019-10-10 19:13:47 -04:00
parent 89672ed0a4
commit af2b6207b2
2 changed files with 8 additions and 4 deletions

View file

@ -46,6 +46,7 @@ Zotero.Sync.APIClient = function (options) {
Zotero.Sync.APIClient.prototype = {
MAX_OBJECTS_PER_REQUEST: 100,
MIN_GZIP_SIZE: 1000,
UPLOAD_TIMEOUT: 60,
getKeyInfo: Zotero.Promise.coroutine(function* (options={}) {
@ -379,7 +380,8 @@ Zotero.Sync.APIClient.prototype = {
"If-Unmodified-Since-Version": libraryVersion
},
body: json,
successCodes: [200, 412]
successCodes: [200, 412],
timeout: this.UPLOAD_TIMEOUT,
});
this._check412(xmlhttp);
return {
@ -413,7 +415,8 @@ Zotero.Sync.APIClient.prototype = {
headers: {
"If-Unmodified-Since-Version": libraryVersion
},
successCodes: [204, 412]
successCodes: [204, 412],
timeout: this.UPLOAD_TIMEOUT,
});
this._check412(xmlhttp);
return this._getLastModifiedVersion(xmlhttp);
@ -481,6 +484,7 @@ Zotero.Sync.APIClient.prototype = {
},
body: JSON.stringify(data),
successCodes: [200, 412],
timeout: this.UPLOAD_TIMEOUT,
debug: true
}
);

View file

@ -50,8 +50,8 @@ Zotero.Sync.Data.Engine = function (options) {
this.libraryID = options.libraryID;
this.library = Zotero.Libraries.get(options.libraryID);
this.libraryTypeID = this.library.libraryTypeID;
this.uploadBatchSize = 25;
this.uploadDeletionBatchSize = 50;
this.uploadBatchSize = 10;
this.uploadDeletionBatchSize = 25;
this.maxUploadTries = 5;
this.failed = false;