Avoid conflicts with server files with maxed-out 32-bit int mod times (which I think happened for only a few days after the AWS migration) by automatically using locally modified version

This commit is contained in:
Dan Stillman 2011-04-04 17:52:28 +00:00
parent 62edf3317d
commit f2c2c9f049

View File

@ -372,11 +372,11 @@ Zotero.Sync.Storage.Session.ZFS.prototype._processUploadFile = function (data) {
if (info) {
// Remote mod time
var mtime = info.mtime;
// Local file time
var fmtime = item.attachmentModificationTime;
var same = false;
var useLocal = false;
if (fmtime == mtime) {
same = true;
Zotero.debug("File mod time matches remote file -- skipping upload");
@ -398,6 +398,11 @@ Zotero.Sync.Storage.Session.ZFS.prototype._processUploadFile = function (data) {
Zotero.debug("File mod time (" + fmtime + ") is exactly one hour off remote file (" + mtime + ") "
+ "-- assuming time zone issue and skipping upload");
}
// Ignore maxed-out 32-bit ints, from brief problem after switch to 32-bit servers
else if (mtime == 2147483647) {
Zotero.debug("Remote mod time is invalid -- uploading local file version");
useLocal = true;
}
if (same) {
Zotero.debug(Zotero.Sync.Storage.getSyncedModificationTime(item.id));
@ -414,7 +419,7 @@ Zotero.Sync.Storage.Session.ZFS.prototype._processUploadFile = function (data) {
}
var smtime = Zotero.Sync.Storage.getSyncedModificationTime(item.id);
if (smtime != mtime) {
if (!useLocal && smtime != mtime) {
var localData = { modTime: fmtime };
var remoteData = { modTime: mtime };
Zotero.Sync.Storage.QueueManager.addConflict(