Skip to content

Commit

Permalink
Merge pull request #23 from hellofresh/patch/backport-rabbitmq-fix
Browse files Browse the repository at this point in the history
Backport PR-22 to 1.x branch
  • Loading branch information
puellanivis committed Nov 8, 2018
2 parents 7074f86 + 9139ee4 commit 10383b7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions checks/rabbitmq/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,17 @@ func New(config Config) func() error {
return err
}

done := make(chan struct{}, 1)
defer close(done)
done := make(chan struct{})

go func() {
// block until: a message is received, or message channel is closed (consume timeout)
<-messages

// release the channel resources, and unblock the receive on done below
close(done)

// now drain any incidental remaining messages
for range messages {
done <- struct{}{}
}
}()

Expand Down

0 comments on commit 10383b7

Please sign in to comment.