Skip to content

Commit

Permalink
change cancel place (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuel-v-r authored and harlow committed Feb 18, 2019
1 parent 2037463 commit 245d1bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ func (c *Consumer) Scan(ctx context.Context, fn func(*Record) ScanStatus) error
defer wg.Done()

if err := c.ScanShard(ctx, shardID, fn); err != nil {
cancel()

select {
case errc <- fmt.Errorf("shard %s error: %v", shardID, err):
// first error to occur
default:
// error has already occured
}
}

cancel()
}(shardID)
}

Expand Down

0 comments on commit 245d1bd

Please sign in to comment.