From 1774f48d0708b00e217192ed37c4b3efb657065f Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 8 Mar 2020 21:59:19 +0100 Subject: [PATCH] fix sync --- src/services/sync.js | 5 +---- src/services/sync_update.js | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/services/sync.js b/src/services/sync.js index 60ac346f7..67994d68a 100644 --- a/src/services/sync.js +++ b/src/services/sync.js @@ -156,10 +156,7 @@ async function pullSync(syncContext) { appliedPulls++; } - // can be undefined for options with isSynced=false - if (entity) { - await syncUpdateService.updateEntity(sync, entity, syncContext.sourceId); - } + await syncUpdateService.updateEntity(sync, entity, syncContext.sourceId); } stats.outstandingPulls = resp.maxSyncId - sync.id; diff --git a/src/services/sync_update.js b/src/services/sync_update.js index 4415a62df..10b8a5112 100644 --- a/src/services/sync_update.js +++ b/src/services/sync_update.js @@ -4,6 +4,11 @@ const syncTableService = require('./sync_table'); const eventService = require('./events'); async function updateEntity(sync, entity, sourceId) { + // can be undefined for options with isSynced=false + if (!entity) { + return; + } + const {entityName} = sync; if (entityName === 'notes') {