Skip to content

Commit

Permalink
Merge pull request #587 from benburkert/shutdown-method
Browse files Browse the repository at this point in the history
replace label & goto with a method
  • Loading branch information
eapache committed Dec 21, 2015
2 parents bb163bf + 29d4b91 commit d7ff2eb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions async_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,8 @@ func (bp *brokerProducer) run() {
select {
case msg := <-bp.input:
if msg == nil {
goto shutdown
bp.shutdown()
return
}

if msg.flags&syn == syn {
Expand Down Expand Up @@ -637,8 +638,9 @@ func (bp *brokerProducer) run() {
output = nil
}
}
}

shutdown:
func (bp *brokerProducer) shutdown() {
for !bp.buffer.empty() {
select {
case response := <-bp.responses:
Expand Down

0 comments on commit d7ff2eb

Please sign in to comment.