Skip to content

Commit

Permalink
reSync
Browse files Browse the repository at this point in the history
  • Loading branch information
lealife committed Aug 14, 2021
1 parent 5cb9825 commit 9c02a81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/note.js
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,7 @@ var Note = {
var path = attachs[i].Path;
if(path && path.indexOf(fileBasePath) >= 0) {
try {
fs.unlink(path);
fs.unlink(path, () => {});
} catch(e) {
console.error(e);
}
Expand Down
10 changes: 7 additions & 3 deletions src/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var Sync = {
},
*/
_needIncrSyncAgain: false,
_reSyncAgainTimes: 0,

// notebook
_syncNotebookIsLastChunk: false,
Expand Down Expand Up @@ -711,7 +712,8 @@ var Sync = {
// send changes
callback && callback();
} else {

console.error('_needIncrSyncAgain callback')
callback && callback();
}
});

Expand Down Expand Up @@ -778,6 +780,8 @@ var Sync = {
console.log('inc sync start');
if (again) {
console.log('again >>');
} else {
me._reSyncAgainTimes = 0
}

// 得到当前LastSyncUsn
Expand Down Expand Up @@ -953,7 +957,6 @@ var Sync = {
return;
}
console.error('---?? checkNeedIncSyncAgain ??------' + usn)
console.trace();
me._needIncrSyncAgain = true;
}
}
Expand Down Expand Up @@ -1205,8 +1208,9 @@ var Sync = {
me.addSyncProcessStatus(10);

// 重新再来一次增量同步
if (me._needIncrSyncAgain) {
if (me._needIncrSyncAgain && me._reSyncAgainTimes < 5) {
console.error(' needIncrSyncAgain')
me._reSyncAgainTimes++
me.fixConflictsForSendChanges(function() {
me.incrSync(true);
});
Expand Down

0 comments on commit 9c02a81

Please sign in to comment.