Skip to content

Commit

Permalink
Prevent sending data to closed dirtyResult channel
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinfish committed Sep 5, 2019
1 parent 7dd2941 commit f5592ff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,10 @@ func (sl *LeaserCheckpointer) persistDirtyPartitions(ctx context.Context) error
for _, pid := range pids {
go func(id string) {
err := sl.persistLease(ctx, id)
resCh <- dirtyResult{
Err: err,
PartitionID: id,
select {
case <-ctx.Done():
return
case resCh <- dirtyResult{PartitionID: id, Err: err}:
}
}(pid)
}
Expand Down

0 comments on commit f5592ff

Please sign in to comment.