Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
sync checks for note_contents
zadambe378f71b07f
diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.jsindex badd141aae..bf8e207cbb 100644--- a/src/services/consistency_checks.js+++ b/src/services/consistency_checks.js@@ -430,6 +430,7 @@ async function runSyncRowChecks(entityName, key) {async function findSyncRowsIssues() {await runSyncRowChecks("notes", "noteId");+ await runSyncRowChecks("note_contents", "noteId");await runSyncRowChecks("note_revisions", "noteRevisionId");await runSyncRowChecks("branches", "branchId");await runSyncRowChecks("recent_notes", "branchId");diff --git a/src/services/sync.js b/src/services/sync.jsindex f297638c73..14b950fa5d 100644--- a/src/services/sync.js+++ b/src/services/sync.js@@ -49,7 +49,11 @@ async function sync() {catch (e) {proxyToggle = !proxyToggle;- if (e.message && (e.message.includes('ECONNREFUSED') || e.message.includes('ERR_CONNECTION_REFUSED'))) {+ if (e.message &&+ (e.message.includes('ECONNREFUSED') ||+ e.message.includes('ERR_CONNECTION_REFUSED') ||+ e.message.includes('Bad Gateway'))) {+log.info("No connection to sync server.");return {@@ -263,9 +267,7 @@ async function getEntityRow(entityName, entityId) {const entity = await sql.getRow(`SELECT * FROM ${entityName} WHERE ${primaryKey} = ?`, [entityId]);if (!entity) {- console.log(entityName, entityId);-- console.log(`SELECT * FROM ${entityName} WHERE ${primaryKey} = '${entityId}'`);+ throw new Error(`Entity ${entityName} ${entityId} not found.`);}if (['note_contents', 'note_revisions'].includes(entityName) && entity.content !== null) {