- Don't set the last local sync time after a download if an upload fails to avoid reuploading of downloaded data
- If no local sync time set (because an initial upload never went through), ignore remote sync time and repull all data so downloaded items aren't reuploaded
This commit is contained in:
parent
66a5b1ab14
commit
a9dbe02ef9
1 changed files with 11 additions and 3 deletions
|
@ -1333,6 +1333,16 @@ Zotero.Sync.Server = new function () {
|
|||
if (!lastsync) {
|
||||
lastsync = 1;
|
||||
}
|
||||
|
||||
// If no local timestamp is stored, don't use remote time
|
||||
//
|
||||
// This used to be possible when remote time was saved whether or not
|
||||
// the subsequent upload went through
|
||||
var lastLocalSyncTime = Zotero.Sync.Server.lastLocalSyncTime;
|
||||
if (!lastLocalSyncTime) {
|
||||
lastsync = 1;
|
||||
}
|
||||
|
||||
var body = _apiVersionComponent
|
||||
+ '&' + Zotero.Sync.Server.sessionIDComponent
|
||||
+ '&lastsync=' + lastsync;
|
||||
|
@ -1407,7 +1417,6 @@ Zotero.Sync.Server = new function () {
|
|||
|
||||
Zotero.UnresponsiveScriptIndicator.disable();
|
||||
|
||||
var lastLocalSyncTime = Zotero.Sync.Server.lastLocalSyncTime;
|
||||
var lastLocalSyncDate = lastLocalSyncTime ?
|
||||
new Date(lastLocalSyncTime * 1000) : false;
|
||||
|
||||
|
@ -1465,10 +1474,9 @@ Zotero.Sync.Server = new function () {
|
|||
Zotero.debug(xmlstr);
|
||||
}
|
||||
|
||||
Zotero.Sync.Server.lastRemoteSyncTime = response.getAttribute('timestamp');
|
||||
|
||||
if (!xmlstr) {
|
||||
Zotero.debug("Nothing to upload to server");
|
||||
Zotero.Sync.Server.lastRemoteSyncTime = response.getAttribute('timestamp');
|
||||
Zotero.Sync.Server.lastLocalSyncTime = nextLocalSyncTime;
|
||||
Zotero.Sync.Server.nextLocalSyncDate = false;
|
||||
Zotero.DB.commitTransaction();
|
||||
|
|
Loading…
Add table
Reference in a new issue