Skip to content

Commit

Permalink
common/client: prevent double close of channel (#13571)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored Jun 17, 2024
1 parent c0f0c38 commit 796073a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/client/poller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ func Test_Poller(t *testing.T) {

t.Run("Test unsubscribe during polling", func(t *testing.T) {
wait := make(chan struct{})
closeOnce := sync.OnceFunc(func() { close(wait) })
pollFunc := func(ctx context.Context) (Head, error) {
close(wait)
closeOnce()
// Block in polling function until context is cancelled
if <-ctx.Done(); true {
return nil, ctx.Err()
Expand Down

0 comments on commit 796073a

Please sign in to comment.