Skip to content

Commit

Permalink
Merge pull request #95 from mreiferson/stop_panic_95
Browse files Browse the repository at this point in the history
nsq_to_nsq: panic on shutdown
  • Loading branch information
jehiah committed Dec 23, 2014
2 parents e6dfac8 + f45e827 commit 4e74fa1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,12 @@ func (r *Consumer) Stop() {
}

time.AfterFunc(time.Second*30, func() {
r.stopHandlers()
// if we've waited this long handlers are blocked on processing messages
// so we can't just stopHandlers (if any adtl. messages were pending processing
// we would cause a panic on channel close)
//
// instead, we just bypass handler closing and skip to the final exit
r.exit()
})
}
}
Expand Down

0 comments on commit 4e74fa1

Please sign in to comment.