mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 02:52:27 +08:00
consistency check for wrong lastSyncedPush
This commit is contained in:
parent
aab49946f8
commit
c41448f5da
@ -538,6 +538,26 @@ class ConsistencyChecks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findSyncIssues() {
|
||||||
|
const lastSyncedPush = parseInt(sql.getValue("SELECT value FROM options WHERE name = 'lastSyncedPush'"));
|
||||||
|
const maxEntityChangeId = sql.getValue("SELECT MAX(id) FROM entity_changes");
|
||||||
|
|
||||||
|
if (lastSyncedPush > maxEntityChangeId) {
|
||||||
|
if (this.autoFix) {
|
||||||
|
sql.execute("UPDATE options SET value = ? WHERE name = 'lastSyncedPush'", [maxEntityChangeId]);
|
||||||
|
|
||||||
|
this.fixedIssues = true;
|
||||||
|
|
||||||
|
logFix(`Fixed incorrect lastSyncedPush - was ${lastSyncedPush}, needs to be at maximum ${maxEntityChangeId}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.unrecoveredConsistencyErrors = true;
|
||||||
|
|
||||||
|
logFix(`Incorrect lastSyncedPush - is ${lastSyncedPush}, needs to be at maximum ${maxEntityChangeId}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
runAllChecksAndFixers() {
|
runAllChecksAndFixers() {
|
||||||
this.unrecoveredConsistencyErrors = false;
|
this.unrecoveredConsistencyErrors = false;
|
||||||
this.fixedIssues = false;
|
this.fixedIssues = false;
|
||||||
@ -552,6 +572,8 @@ class ConsistencyChecks {
|
|||||||
|
|
||||||
this.findWronglyNamedAttributes();
|
this.findWronglyNamedAttributes();
|
||||||
|
|
||||||
|
this.findSyncIssues();
|
||||||
|
|
||||||
// root branch should always be expanded
|
// root branch should always be expanded
|
||||||
sql.execute("UPDATE branches SET isExpanded = 1 WHERE branchId = 'root'");
|
sql.execute("UPDATE branches SET isExpanded = 1 WHERE branchId = 'root'");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user