Skip to content

Commit

Permalink
drainErrChan returns if channel is closed (#4314) (#4315)
Browse files Browse the repository at this point in the history
(cherry picked from commit 00550ca)

Co-authored-by: Anderson Queiroz <anderson.queiroz@elastic.co>
  • Loading branch information
mergify[bot] and AndersonQ authored Feb 23, 2024
1 parent 9f351e8 commit e1ad676
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/component/runtime/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3496,7 +3496,11 @@ func newDebugLogger(t *testing.T) *logger.Logger {
func drainErrChan(ch chan error) {
for {
select {
case <-ch:
case _, ok := <-ch:
// channel is closed, nothing to drain
if !ok {
return
}
default:
return
}
Expand Down

0 comments on commit e1ad676

Please sign in to comment.