From 03d86209ca089ebc3bfce5269b5e9eafb89a9713 Mon Sep 17 00:00:00 2001 From: azivner Date: Sat, 16 Dec 2017 12:30:37 -0500 Subject: [PATCH] changed order of syncs to maybe improve racing problems --- services/build.js | 2 +- services/sync.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/services/build.js b/services/build.js index 57ec06e03..f4d0bcd9d 100644 --- a/services/build.js +++ b/services/build.js @@ -1 +1 @@ -module.exports = { build_date:"2017-12-16T09:02:14-05:00", build_revision: "4381d885243568fe5d4c60dce36bf0c2f98507fe" }; +module.exports = { build_date:"2017-12-16T12:22:45-05:00", build_revision: "0c0e95b91e6d42c9aaf7921d83630ab36a41e0ae" }; diff --git a/services/sync.js b/services/sync.js index 96dbb76e0..f09e4147b 100644 --- a/services/sync.js +++ b/services/sync.js @@ -243,6 +243,14 @@ async function sendEntity(syncContext, entity, entityName) { } async function checkContentHash(syncContext) { + const resp = await syncRequest(syncContext, 'GET', '/api/sync/check'); + + if (await getLastSyncedPull() < resp.max_sync_id) { + log.info("There are some outstanding pulls, skipping content check."); + + return; + } + const lastSyncedPush = await getLastSyncedPush(); const notPushedSyncs = await sql.getSingleValue("SELECT COUNT(*) FROM sync WHERE id > ?", [lastSyncedPush]); @@ -252,14 +260,6 @@ async function checkContentHash(syncContext) { return; } - const resp = await syncRequest(syncContext, 'GET', '/api/sync/check'); - - if (await getLastSyncedPull() < resp.max_sync_id) { - log.info("There are some outstanding pulls, skipping content check."); - - return; - } - const hashes = await content_hash.getHashes(); let allChecksPassed = true;