Skip to content

Build your personal knowledge base with Trilium Notes

changed order of syncs to maybe improve racing problems

azivner03d86209ca08
diff --git a/services/build.js b/services/build.js
index 57ec06e03d..f4d0bcd9d8 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 96dbb76e06..f09e4147b6 100644
--- a/services/sync.js
+++ b/services/sync.js
@@ -243,19 +243,19 @@ async function sendEntity(syncContext, entity, entityName) {
}
async function checkContentHash(syncContext) {
- const lastSyncedPush = await getLastSyncedPush();
- const notPushedSyncs = await sql.getSingleValue("SELECT COUNT(*) FROM sync WHERE id > ?", [lastSyncedPush]);
+ const resp = await syncRequest(syncContext, 'GET', '/api/sync/check');
- if (notPushedSyncs > 0) {
- log.info("There's " + notPushedSyncs + " outstanding pushes, skipping content check.");
+ if (await getLastSyncedPull() < resp.max_sync_id) {
+ log.info("There are some outstanding pulls, skipping content check.");
return;
}
- const resp = await syncRequest(syncContext, 'GET', '/api/sync/check');
+ const lastSyncedPush = await getLastSyncedPush();
+ const notPushedSyncs = await sql.getSingleValue("SELECT COUNT(*) FROM sync WHERE id > ?", [lastSyncedPush]);
- if (await getLastSyncedPull() < resp.max_sync_id) {
- log.info("There are some outstanding pulls, skipping content check.");
+ if (notPushedSyncs > 0) {
+ log.info("There's " + notPushedSyncs + " outstanding pushes, skipping content check.");
return;
}