From 45fba6d7f8a53d4ebbd48b1205442410b6f1dc46 Mon Sep 17 00:00:00 2001 From: azivner Date: Thu, 14 Dec 2017 07:57:31 -0500 Subject: [PATCH] save sync records even if sync isn't configured, but don't put them as outstanding pushes (should be still available for pulls) --- services/build.js | 2 +- services/sync_table.js | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/services/build.js b/services/build.js index 23a9cd9e6..d274a49c9 100644 --- a/services/build.js +++ b/services/build.js @@ -1 +1 @@ -module.exports = { build_date:"2017-12-12T23:57:58-05:00", build_revision: "2fa57b79fd972b3eda6eb8ef1d26e9915b75fd96" }; +module.exports = { build_date:"2017-12-13T23:36:38-05:00", build_revision: "180a7432caa0ca43986a24e7f911a64c48f8a134" }; diff --git a/services/sync_table.js b/services/sync_table.js index f4c038087..db1df019a 100644 --- a/services/sync_table.js +++ b/services/sync_table.js @@ -28,13 +28,17 @@ async function addRecentNoteSync(notePath, sourceId) { } async function addEntitySync(entityName, entityId, sourceId) { - if (sync_setup.isSyncSetup) { - await sql.replace("sync", { - entity_name: entityName, - entity_id: entityId, - sync_date: utils.nowDate(), - source_id: sourceId || source_id.currentSourceId - }); + await sql.replace("sync", { + entity_name: entityName, + entity_id: entityId, + sync_date: utils.nowDate(), + source_id: sourceId || source_id.currentSourceId + }); + + if (!sync_setup.isSyncSetup) { + // this is because the "server" instances shouldn't have outstanding pushes + // useful when you fork the DB for new "client" instance, it won't try to sync the whole DB + await sql.execute("UPDATE options SET opt_value = (SELECT MAX(id) FROM sync) WHERE opt_name = 'last_synced_push'"); } }