Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-ogrady committed Dec 8, 2020
1 parent 597f233 commit 1502917
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,14 @@ func (s *Syncer) syncRange(
s.concurrency = startingConcurrency
s.goalConcurrency = s.concurrency

// Spawn syncing goroutines
// We create a separate derivative context here instead of
// replacing the provided ctx because the context returned
// by errgroup.WithContext is canceled as soon as Wait returns.
// If this canceled context is passed to a handler or helper,
// it can have unintended consequences (some functions
// return immediately if the context is canceled).
//
// Source: https://godoc.org/golang.org/x/sync/errgroup
g, pipelineCtx := errgroup.WithContext(ctx)
g.Go(func() error {
return s.addBlockIndices(pipelineCtx, blockIndices, s.nextIndex, endIndex)
Expand Down

0 comments on commit 1502917

Please sign in to comment.