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

Fix jetstream removeSub logic #873

merged 1 commit into from Dec 15, 2021

Conversation

matthewdevenny
Copy link
Contributor

@matthewdevenny matthewdevenny commented Dec 15, 2021

Signed-off-by: Matthew DeVenny matt@boxboat.com

When removeSub calls jsi.hbc.Stop() it is possible that the timer has already expired
https://github.com/nats-io/nats.go/blob/main/nats.go#L3919

from timer.Stop()

For a timer created with AfterFunc(d, f), if t.Stop returns false, then the timer has already expired 
and the function f has been started in its own goroutine; Stop does not wait for f to complete before 
returning. If the caller needs to know whether f is completed, it must coordinate with f explicitly.

This PR checks to see if sub.closed == true and returns

@coveralls
Copy link

coveralls commented Dec 15, 2021

Coverage Status

Coverage decreased (-0.1%) to 85.055% when pulling 2c63528 on boxboatmatt:fix-activity-check into b337a5c on nats-io:main.

js.go Outdated Show resolved Hide resolved
js.go Outdated Show resolved Hide resolved
js.go Outdated Show resolved Hide resolved
js.go Show resolved Hide resolved
Signed-off-by: Matthew DeVenny <matt@boxboat.com>
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for your contribution!

@kozlovic kozlovic merged commit e5a5689 into nats-io:main Dec 15, 2021
@matthewdevenny matthewdevenny deleted the fix-activity-check branch December 15, 2021 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants