Skip to content

Commit

Permalink
sync: fix incorrect error reported by graceful cutoff - fixes rclone#…
Browse files Browse the repository at this point in the history
…5203

Before this change, a sync which was finished with a graceful transfer
cutoff could return "context canceled" instead of the correct error.

This fixes the problem by ignoring "context canceled" errors if we
have done a graceful stop.
  • Loading branch information
ncw committed Apr 6, 2021
1 parent dc28652 commit 54771e4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ func (s *syncCopyMove) processError(err error) {
// Cancel the march and stop the pipes
s.inCancel()
}
} else if err == context.Canceled && s.inCtx.Err() != nil {
// Ignore context Canceled if we have called s.inCancel()
return
}
s.errorMu.Lock()
defer s.errorMu.Unlock()
Expand Down

0 comments on commit 54771e4

Please sign in to comment.