Skip to content

Commit

Permalink
Remove auto-unsub for now for fetch since it leaks subs in older servers
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Aug 9, 2021
1 parent bce6f98 commit 0b3386c
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions js.go
Expand Up @@ -2098,13 +2098,6 @@ func (sub *Subscription) Fetch(batch int, opts ...PullOpt) ([]*Msg, error) {
nr.Expires = expires
req, _ = json.Marshal(nr)

// Since first message was an error we UNSUB (batch+1)
// since we are counting it as the first message.
err = s.AutoUnsubscribe(batch + 1)
if err != nil {
return nil, err
}

// Make another request and wait for the messages...
err = nc.publish(reqNext, inbox, nil, req)
if err != nil {
Expand Down Expand Up @@ -2136,13 +2129,6 @@ func (sub *Subscription) Fetch(batch int, opts ...PullOpt) ([]*Msg, error) {
s.Unsubscribe()
return nil, err
}
} else {
// We are receiving messages at this point. Send UNSUB to let
// the server clear interest once enough replies are delivered.
err = s.AutoUnsubscribe(batch)
if err != nil {
return nil, err
}
}

msgs = append(msgs, firstMsg)
Expand Down

0 comments on commit 0b3386c

Please sign in to comment.