Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jetstream removeSub logic #873

Merged
merged 1 commit into from Dec 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 {
matthewdevenny marked this conversation as resolved.
Show resolved Hide resolved
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