mirror of
https://github.com/zadam/trilium.git
synced 2025-01-01 12:52:17 +08:00
sync fixes
This commit is contained in:
parent
18b13657fd
commit
8850de51f5
6 changed files with 22 additions and 5 deletions
|
@ -65,3 +65,5 @@ DELETE FROM note_revision_contents WHERE noteRevisionId IN (
|
|||
);
|
||||
DELETE FROM note_revisions WHERE isErased = 1;
|
||||
DELETE FROM notes WHERE isErased = 1;
|
||||
|
||||
UPDATE entity_changes SET isErased = COALESCE((SELECT isErased FROM entity_changes AS sub WHERE sub.entityId = entity_changes.entityId AND sub.entityName = 'note_revisions'), 0) WHERE entityName = 'note_revision_contents';
|
||||
|
|
|
@ -55,6 +55,15 @@ class Attribute {
|
|||
return this.noteCache.notes[this.value];
|
||||
}
|
||||
}
|
||||
|
||||
// for logging etc
|
||||
get pojo() {
|
||||
const pojo = {...this};
|
||||
|
||||
delete pojo.noteCache;
|
||||
|
||||
return pojo;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Attribute;
|
||||
|
|
|
@ -333,14 +333,18 @@ async function findSimilarNotes(noteId) {
|
|||
let value = attr.value;
|
||||
let factor = 1;
|
||||
|
||||
if (value.startsWith('http')) {
|
||||
if (!value) {
|
||||
log.info(`Unexpected falsy value for attribute ${JSON.stringify(attr.pojo)}`);
|
||||
continue;
|
||||
}
|
||||
else if (value.startsWith('http')) {
|
||||
value = filterUrlValue(value);
|
||||
|
||||
// words in URLs are not that valuable
|
||||
factor = 0.5;
|
||||
}
|
||||
|
||||
score += gatherRewards(attr.value, factor);
|
||||
score += gatherRewards(value, factor);
|
||||
}
|
||||
|
||||
if (candidateNote.type === baseNote.type) {
|
||||
|
|
|
@ -48,7 +48,7 @@ function initNotSyncedOptions(initialized, startNotePath = 'root', opts = {}) {
|
|||
optionService.createOption('theme', opts.theme || 'white', false);
|
||||
|
||||
optionService.createOption('syncServerHost', opts.syncServerHost || '', false);
|
||||
optionService.createOption('syncServerTimeout', '60000', false);
|
||||
optionService.createOption('syncServerTimeout', '120000', false);
|
||||
optionService.createOption('syncProxy', opts.syncProxy || '', false);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,9 @@ async function pullChanges(syncContext) {
|
|||
setLastSyncedPull(entityChanges[entityChanges.length - 1].entityChange.id);
|
||||
});
|
||||
|
||||
log.info(`Pulled ${entityChanges.length} changes starting at entityChangeId=${lastSyncedPull} in ${pulledDate - startDate}ms and applied them in ${Date.now() - pulledDate}ms, ${outstandingPullCount} outstanding pulls`);
|
||||
const sizeInKb = Math.round(JSON.stringify(resp).length / 1024);
|
||||
|
||||
log.info(`Pulled ${entityChanges.length} changes in ${sizeInKb} KB, starting at entityChangeId=${lastSyncedPull} in ${pulledDate - startDate}ms and applied them in ${Date.now() - pulledDate}ms, ${outstandingPullCount} outstanding pulls`);
|
||||
}
|
||||
|
||||
if (atLeastOnePullApplied) {
|
||||
|
|
|
@ -23,6 +23,6 @@ module.exports = {
|
|||
// and we need to override it with config from config.ini
|
||||
return !!syncServerHost && syncServerHost !== 'disabled';
|
||||
},
|
||||
getSyncTimeout: () => parseInt(get('syncServerTimeout')) || 60000,
|
||||
getSyncTimeout: () => parseInt(get('syncServerTimeout')) || 120000,
|
||||
getSyncProxy: () => get('syncProxy')
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue