Skip to content

Commit

Permalink
Allow infinite retries for context driven Publish
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Mar 17, 2022
1 parent ba55e15 commit 7c29a70
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js.go
Expand Up @@ -433,7 +433,7 @@ func (js *js) PublishMsg(m *Msg, opts ...PubOpt) (*PubAck, error) {
}

if err != nil {
for r, ttl := 0, o.ttl; err == ErrNoResponders && r < o.rnum; r++ {
for r, ttl := 0, o.ttl; err == ErrNoResponders && (r < o.rnum || o.rnum < 0); r++ {
// To protect against small blips in leadership changes etc, if we get a no responders here retry.
if o.ctx != nil {
select {
Expand Down

0 comments on commit 7c29a70

Please sign in to comment.