mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Fix for leaked subs on non-leader change
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -613,13 +613,9 @@ func (o *consumer) setLeader(isLeader bool) {
|
||||
isRunning := o.ackSub != nil
|
||||
o.mu.RUnlock()
|
||||
|
||||
if mset == nil {
|
||||
return
|
||||
}
|
||||
|
||||
// If we are here we have a change in leader status.
|
||||
if isLeader {
|
||||
if isRunning {
|
||||
if mset == nil || isRunning {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -684,9 +680,6 @@ func (o *consumer) setLeader(isLeader bool) {
|
||||
|
||||
} else {
|
||||
// Shutdown the go routines and the subscriptions.
|
||||
if !isRunning {
|
||||
return
|
||||
}
|
||||
o.mu.Lock()
|
||||
o.unsubscribe(o.ackSub)
|
||||
o.unsubscribe(o.reqSub)
|
||||
|
||||
Reference in New Issue
Block a user