diff --git a/db/migrations/0173__isErased_in_entity_changes.sql b/db/migrations/0173__isErased_in_entity_changes.sql index 714a973f7..af10ffac4 100644 --- a/db/migrations/0173__isErased_in_entity_changes.sql +++ b/db/migrations/0173__isErased_in_entity_changes.sql @@ -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'; diff --git a/src/services/note_cache/entities/attribute.js b/src/services/note_cache/entities/attribute.js index 3b4d68ca7..44024d35c 100644 --- a/src/services/note_cache/entities/attribute.js +++ b/src/services/note_cache/entities/attribute.js @@ -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; diff --git a/src/services/note_cache/similarity.js b/src/services/note_cache/similarity.js index d80d399e6..ddca8c306 100644 --- a/src/services/note_cache/similarity.js +++ b/src/services/note_cache/similarity.js @@ -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) { diff --git a/src/services/options_init.js b/src/services/options_init.js index 056d30c89..cc9b2e3a4 100644 --- a/src/services/options_init.js +++ b/src/services/options_init.js @@ -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); } diff --git a/src/services/sync.js b/src/services/sync.js index a03db6d9c..df926c77e 100644 --- a/src/services/sync.js +++ b/src/services/sync.js @@ -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) { diff --git a/src/services/sync_options.js b/src/services/sync_options.js index 6c0e19359..a63b89514 100644 --- a/src/services/sync_options.js +++ b/src/services/sync_options.js @@ -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') };