diff --git a/cmd/mirror-main.go b/cmd/mirror-main.go index 6e197bd5..c2592080 100644 --- a/cmd/mirror-main.go +++ b/cmd/mirror-main.go @@ -496,19 +496,20 @@ func (mj *mirrorJob) monitorMirrorStatus(cancel context.CancelFunc) (errDuringMi mirrorTotalOps.Inc() if sURLs.Error != nil { - mirrorFailedOps.Inc() + var ignoreErr bool + switch { case sURLs.SourceContent != nil: - if !isErrIgnored(sURLs.Error) { + if isErrIgnored(sURLs.Error) { + ignoreErr = true + } else { errorIf(sURLs.Error.Trace(sURLs.SourceContent.URL.String()), fmt.Sprintf("Failed to copy `%s`.", sURLs.SourceContent.URL.String())) - errDuringMirror = true } case sURLs.TargetContent != nil: // When sURLs.SourceContent is nil, we know that we have an error related to removing errorIf(sURLs.Error.Trace(sURLs.TargetContent.URL.String()), fmt.Sprintf("Failed to remove `%s`.", sURLs.TargetContent.URL.String())) - errDuringMirror = true default: if sURLs.ErrorCond == differInUnknown { errorIf(sURLs.Error.Trace(), "Failed to perform mirroring") @@ -516,13 +517,16 @@ func (mj *mirrorJob) monitorMirrorStatus(cancel context.CancelFunc) (errDuringMi errorIf(sURLs.Error.Trace(), "Failed to perform mirroring, with error condition (%s)", sURLs.ErrorCond) } - errDuringMirror = true } - // Do not quit mirroring if we are in --watch or --active-active mode - if !mj.opts.activeActive && !mj.opts.isWatch { - cancel() - cancelInProgress = true + if !ignoreErr { + mirrorFailedOps.Inc() + errDuringMirror = true + // Quit mirroring if --watch and --active-active are not passed + if !mj.opts.activeActive && !mj.opts.isWatch { + cancel() + cancelInProgress = true + } } continue