From 492c3bd20689fb3fd02973da3fcdc707ba6f388a Mon Sep 17 00:00:00 2001 From: Matthew DeVenny Date: Wed, 15 Dec 2021 14:57:17 -0700 Subject: [PATCH] Fix activityCheck to handle case when timer has been stopped Signed-off-by: Matthew DeVenny --- js.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/js.go b/js.go index 46f86888b..88203e89d 100644 --- a/js.go +++ b/js.go @@ -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 } @@ -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) })