From 33d9a47f4b5689b03843e6749de9b4fcac9dfa6c Mon Sep 17 00:00:00 2001 From: cgeek <cem.moreau@gmail.com> Date: Sat, 29 Dec 2018 00:04:49 +0100 Subject: [PATCH] [fix] #1322 `sync`: chained transactions generate make the sync fail --- app/lib/computation/QuickSync.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/lib/computation/QuickSync.ts b/app/lib/computation/QuickSync.ts index ca6c897cd..354a9bd70 100644 --- a/app/lib/computation/QuickSync.ts +++ b/app/lib/computation/QuickSync.ts @@ -169,8 +169,14 @@ export class QuickSynchronizer { // Fills in correctly the SINDEX await Promise.all(_.where(sync_sindex.concat(local_sindex), { op: 'UPDATE' }).map(async (entry: any) => { if (!entry.conditions) { - const src = await this.dal.sindexDAL.getSource(entry.identifier, entry.pos); - entry.conditions = src.conditions; + if (entry.srcType === 'D') { + entry.conditions = 'SIG(' + entry.identifier + ')' + } else { + // First: have a look locally, but only chained transactions would have `localSrc` matching (giving conditions) + const localSrc = local_sindex.filter(s => s.identifier === entry.identifier && s.pos === entry.pos && s.conditions)[0] + const src = localSrc || (await this.dal.getSource(entry.identifier, entry.pos, false)) + entry.conditions = src.conditions + } } })) -- GitLab