Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terminate tester when one of the queue consumers died #165

Merged
merged 1 commit into from
Jan 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tester/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tester

import (
"fmt"
"log"
"sync"
)

Expand Down Expand Up @@ -82,15 +83,21 @@ func (q *queue) waitConsumersInit() {
logger.Printf("Consumers in Queue %s", q.topic)
for cons := range q.groupConsumers {
logger.Printf("waiting for group consumer %s to be running", cons.queue.topic)
<-cons.state.WaitForState(running)
logger.Printf(" --> %s is running", cons.queue.topic)
select {
case <-cons.state.WaitForState(killed):
log.Printf("At least one consumer was killed. No point in waiting for it")
return
case <-cons.state.WaitForState(running):
logger.Printf(" --> %s is running", cons.queue.topic)
}
}

for cons := range q.simpleConsumers {
logger.Printf("waiting for simple consumer %s to be ready", cons.queue.topic)
select {
case <-cons.state.WaitForState(running):
case <-cons.state.WaitForState(stopped):
case <-cons.state.WaitForState(killed):
db7 marked this conversation as resolved.
Show resolved Hide resolved
}
logger.Printf(" --> %s is ready", cons.queue.topic)
}
Expand Down