Skip to content

Commit 0a35501

Browse files
committed
fix(SyncProcess): Fix getmembersToPersist
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent c3c7d7d commit 0a35501

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/lib/strategies/Default.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,27 @@ export default class SyncProcess {
108108
getMembersToPersist() {
109109
const members = []
110110
// Stage 0
111-
if (!this.serverPlanStage1 || !this.localPlanStage1) {
111+
if (
112+
(!this.serverPlanStage1 || !this.localPlanStage1) &&
113+
(!this.serverPlanStage2 || !this.localPlanStage2) &&
114+
(!this.planStage3Local || !this.planStage3Server) &&
115+
this.actionsPlanned === 0
116+
) {
112117
members.push('localScanResult')
113118
members.push('serverScanResult')
114119
}
115120

116121
// Stage 1
117-
if (!this.serverPlanStage2 || !this.localPlanStage2) {
122+
if (
123+
(!this.serverPlanStage2 || !this.localPlanStage2) &&
124+
(!this.planStage3Local || !this.planStage3Server) && this.actionsPlanned === 0
125+
) {
118126
members.push('localPlanStage1')
119127
members.push('serverPlanStage1')
120128
}
121129

122130
// Stage 2
123-
if (!this.planStage3Local || !this.planStage3Server) {
131+
if ((!this.planStage3Local || !this.planStage3Server) && this.actionsPlanned === 0) {
124132
members.push('localPlanStage2')
125133
members.push('serverPlanStage2')
126134
}

src/lib/strategies/Unidirectional.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default class UnidirectionalSyncProcess extends DefaultStrategy {
3434
getMembersToPersist() {
3535
const members = []
3636
// Stage 0
37-
if (!this.revertPlan) {
37+
if (!this.revertPlan && this.actionsPlanned === 0) {
3838
members.push('localScanResult')
3939
members.push('serverScanResult')
4040
}
@@ -308,7 +308,7 @@ export default class UnidirectionalSyncProcess extends DefaultStrategy {
308308

309309
await Parallel.each(
310310
sourceScanResult.CREATE.getActions(),
311-
async (action) => {
311+
async(action) => {
312312
// recreate it on slave resource otherwise
313313
const payload = await this.translateCompleteItem(
314314
action.payload,
@@ -331,15 +331,15 @@ export default class UnidirectionalSyncProcess extends DefaultStrategy {
331331

332332
await Parallel.each(
333333
targetScanResult.CREATE.getActions(),
334-
async (action) => {
334+
async(action) => {
335335
slavePlan.REMOVE.commit({ ...action, type: ActionType.REMOVE })
336336
},
337337
ACTION_CONCURRENCY
338338
)
339339

340340
await Parallel.each(
341341
targetScanResult.UPDATE.getActions(),
342-
async (action) => {
342+
async(action) => {
343343
const payload = action.oldItem.cloneWithLocation(
344344
false,
345345
action.payload.location
@@ -360,7 +360,7 @@ export default class UnidirectionalSyncProcess extends DefaultStrategy {
360360

361361
await Parallel.each(
362362
targetScanResult.MOVE.getActions(),
363-
async (action) => {
363+
async(action) => {
364364
const payload = action.payload.cloneWithLocation(
365365
false,
366366
action.oldItem.location
@@ -389,7 +389,7 @@ export default class UnidirectionalSyncProcess extends DefaultStrategy {
389389
)
390390
if (newItem instanceof Folder) {
391391
const nonexistingItems = []
392-
await newItem.traverse(async (child, parentFolder) => {
392+
await newItem.traverse(async(child, parentFolder) => {
393393
child.id = Mappings.mapId(mappingsSnapshot, child, fakeLocation)
394394
if (typeof child.id === 'undefined') {
395395
nonexistingItems.push(child)

0 commit comments

Comments
 (0)