Return sooner in _checkForUpdatedFile() on SYNC_STATE_TO_UPLOAD

Before file.stat() instead of after, though it probably doesn't really
matter because the file is already open, which makes the stat call much
faster
This commit is contained in:
Dan Stillman 2021-03-23 03:11:57 -04:00
parent dc12a2c95a
commit 45968375d8

View file

@ -332,6 +332,17 @@ Zotero.Sync.Storage.Local = {
try {
file = yield OS.File.open(path);
// If file is already marked for upload, skip check. Even if the file was changed
// both locally and remotely, conflicts are checked at upload time, so we don't need
// to worry about it here.
//
// This is after open() so that a missing file is properly marked for download.
if (item.attachmentSyncState == this.SYNC_STATE_TO_UPLOAD) {
Zotero.debug("File is already marked for upload");
return false;
}
let info = yield file.stat();
//Zotero.debug("Memory usage: " + memmgr.resident);
@ -343,14 +354,6 @@ Zotero.Sync.Storage.Local = {
fmtime = 0;
}
// If file is already marked for upload, skip check. Even if the file was changed
// both locally and remotely, conflicts are checked at upload time, so we don't need
// to worry about it here.
if (item.attachmentSyncState == this.SYNC_STATE_TO_UPLOAD) {
Zotero.debug("File is already marked for upload");
return false;
}
//Zotero.debug("Stored mtime is " + attachmentData.mtime);
//Zotero.debug("File mtime is " + fmtime);