Skip to content

Commit

Permalink
Fix activityCheck to handle case when timer has been stopped
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew DeVenny <matt@boxboat.com>
  • Loading branch information
matthewdevenny committed Dec 15, 2021
1 parent b337a5c commit 492c3bd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions js.go
Original file line number Diff line number Diff line change
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 492c3bd

Please sign in to comment.