Skip to content

Commit

Permalink
fix: shutdown queue on publish error if not done (#412)
Browse files Browse the repository at this point in the history
* fix: shutdown queue on publish error if not done

* fix: use the more targeted shutdown
  • Loading branch information
jacobheun committed Mar 7, 2023
1 parent dc8dc0f commit 9561a73
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion messagequeue/messagequeue.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,13 @@ func (mq *MessageQueue) sendMessage() {
log.Infof("cant open message sender to peer %s: %s", mq.p, err)
// TODO: cant connect, what now?
mq.publishError(metadata, fmt.Errorf("cant open message sender to peer %s: %w", mq.p, err))
return
select {
case <-mq.done:
return
default:
mq.Shutdown()
return
}
}

for i := 0; i < mq.maxRetries; i++ { // try to send this message until we fail.
Expand Down

0 comments on commit 9561a73

Please sign in to comment.