Skip to content

Commit

Permalink
cmd/thanos/receive: fix close chan panic
Browse files Browse the repository at this point in the history
This commit fixes a panic caused by sending on the chan which is closed
too early. This chan was closed when the setup func returned, rather
than when the group's goroutine returned.

Fixes: thanos-io#1594
Signed-off-by: Lucas Servén Marín <[email protected]>
  • Loading branch information
squat committed Oct 1, 2019
1 parent baf2f3a commit 6abe080
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/thanos/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ func runReceive(
cancel()
})
} else {
defer close(updates)
cancel := make(chan struct{})
g.Add(func() error {
defer close(updates)
updates <- receive.SingleNodeHashring(endpoint)
<-cancel
return nil
Expand Down

0 comments on commit 6abe080

Please sign in to comment.