mirror: Proper exit when preparing diff returns an error (#2681)

A bad synchornization between startMirror() and its caller mirror() happens when preparing the difference of objects between source & target returns an error: mirror() quits when it receives an error from startMirror() without give a chance for that latter to properly stop the parallel mirror manager.

This PR will:
1. Quit mirroring when listing returns an error: this means calculating diff needs to stop and no further action needs to be taken since it can be dangerous especially when --remove flag is passed.
2. Properly stop parallel mirroring manager before quitting.
This commit is contained in:
Anis Elleuch
2019-02-12 14:28:38 -08:00
committed by kannappanr
parent 30491f369d
commit 38965dd432
+2 -1
View File
@@ -516,8 +516,9 @@ func (mj *mirrorJob) startMirror(ctx context.Context, cancelMirror context.Cance
return
}
if sURLs.Error != nil {
stopParallel()
errCh <- sURLs.Error
continue
return
}
if sURLs.SourceContent != nil {