save sync records even if sync isn't configured, but don't put them as outstanding pushes (should be still available for pulls)

This commit is contained in:
azivner 2017-12-14 07:57:31 -05:00
parent 180a7432ca
commit 45fba6d7f8
2 changed files with 12 additions and 8 deletions

View file

@ -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" };

View file

@ -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'");
}
}