Skip to content

Commit e5768b8

Browse files
committed
fix({Default,Merge}SyncProcess#reconcileDiffs): Restrict concurrency + Remove all things touching REMOVEs in Merge
Signed-off-by: Marcel Klehr <[email protected]>
1 parent 64d57be commit e5768b8

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

src/lib/strategies/Default.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ export default class SyncProcess {
847847
}
848848

849849
targetPlan.UPDATE.commit(action)
850-
})
850+
}, ACTION_CONCURRENCY)
851851

852852
await Parallel.each(sourceScanResult.REORDER.getActions(), async(action) => {
853853
if (avoidTargetReorders[action.payload.id]) {
@@ -872,7 +872,7 @@ export default class SyncProcess {
872872
}
873873

874874
targetPlan.REORDER.commit(action)
875-
})
875+
}, ACTION_CONCURRENCY)
876876

877877
return targetPlan
878878
}

src/lib/strategies/Merge.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,6 @@ export default class MergeSyncProcess extends DefaultSyncProcess {
118118
return
119119
}
120120

121-
const concurrentRemoval = targetScanResult.REMOVE.getActions().find(targetRemoval =>
122-
// target removal removed this creation's target (via some chain)
123-
Diff.findChain(mappingsSnapshot, allCreateAndMoveActions, sourceTree, action.payload, targetRemoval, findChainCacheForCreations)
124-
)
125-
if (concurrentRemoval) {
126-
avoidTargetReorders[action.payload.parentId] = true
127-
// Already deleted on target, do nothing.
128-
return
129-
}
130-
131121
targetPlan.CREATE.commit(action)
132122
}, ACTION_CONCURRENCY)
133123

@@ -193,16 +183,9 @@ export default class MergeSyncProcess extends DefaultSyncProcess {
193183
// Updated both on target and sourcely, source has precedence: do nothing sourcely
194184
return
195185
}
196-
const concurrentRemoval = targetRemovals.find(a =>
197-
a.payload.findItem(action.payload.type, Mappings.mapId(mappingsSnapshot, action.payload, a.payload.location)) ||
198-
a.payload.findItem(ItemType.FOLDER, Mappings.mapParentId(mappingsSnapshot, action.payload, a.payload.location)))
199-
if (concurrentRemoval) {
200-
// Already deleted on target, do nothing.
201-
return
202-
}
203186

204187
targetPlan.UPDATE.commit(action)
205-
})
188+
}, ACTION_CONCURRENCY)
206189

207190
await Parallel.each(sourceScanResult.REORDER.getActions(), async(action) => {
208191
if (avoidTargetReorders[action.payload.id]) {
@@ -217,17 +200,8 @@ export default class MergeSyncProcess extends DefaultSyncProcess {
217200
}
218201
}
219202

220-
const findChainCache = {}
221-
const concurrentRemoval = targetRemovals.find(targetRemoval =>
222-
Diff.findChain(mappingsSnapshot, allCreateAndMoveActions, sourceTree, action.payload, targetRemoval, findChainCache)
223-
)
224-
if (concurrentRemoval) {
225-
// Already deleted on target, do nothing.
226-
return
227-
}
228-
229203
targetPlan.REORDER.commit(action)
230-
})
204+
}, ACTION_CONCURRENCY)
231205

232206
return targetPlan
233207
}

0 commit comments

Comments
 (0)