Skip to content

Commit

Permalink
Merge pull request #873 from boxboatmatt/fix-activity-check
Browse files Browse the repository at this point in the history
Fix jetstream removeSub logic
  • Loading branch information
kozlovic committed Dec 15, 2021
2 parents b337a5c + 492c3bd commit e5a5689
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions js.go
Expand Up @@ -1838,7 +1838,7 @@ func (sub *Subscription) scheduleFlowControlResponse(reply string) {
func (sub *Subscription) activityCheck() {
sub.mu.Lock()
jsi := sub.jsi
if jsi == nil {
if jsi == nil || sub.closed {
sub.mu.Unlock()
return
}
Expand All @@ -1847,10 +1847,9 @@ func (sub *Subscription) activityCheck() {
jsi.hbc.Reset(jsi.hbi)
jsi.active = false
nc := sub.conn
closed := sub.closed
sub.mu.Unlock()

if !active && !closed {
if !active {
nc.mu.Lock()
if errCB := nc.Opts.AsyncErrorCB; errCB != nil {
nc.ach.push(func() { errCB(nc, sub, ErrConsumerNotActive) })
Expand Down

0 comments on commit e5a5689

Please sign in to comment.