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

[IMPROVED] Restart consumer behavior during healthz() checks. #4172

Merged
merged 2 commits into from May 16, 2023
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
8 changes: 8 additions & 0 deletions server/jetstream_cluster.go
Expand Up @@ -475,6 +475,10 @@ func (js *jetStream) restartStream(acc *Account, csa *streamAssignment) {
js.mu.Lock()
ca := sa.consumers[cca.Name]
if ca != nil && ca.Group != nil {
// Make sure the node is stopped if still running.
if node := ca.Group.node; node != nil && node.State() != Closed {
node.Stop()
}
// Make sure node is wiped.
ca.Group.node = nil
}
Expand Down Expand Up @@ -543,6 +547,10 @@ func (js *jetStream) isConsumerHealthy(mset *stream, consumer string, ca *consum
restartConsumer := func() {
js.mu.Lock()
if ca.Group != nil {
// Make sure the node is stopped if still running.
if node := ca.Group.node; node != nil && node.State() != Closed {
node.Stop()
}
ca.Group.node = nil
}
deleted := ca.deleted
Expand Down