mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Cleanup timers on consumer leader change
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
@@ -962,6 +962,11 @@ func (o *consumer) setLeader(isLeader bool) {
|
||||
// Reset waiting if we are in pull mode.
|
||||
if o.isPullMode() {
|
||||
o.waiting = newWaitQueue(o.cfg.MaxWaiting)
|
||||
if !o.isDurable() {
|
||||
stopAndClearTimer(&o.dtmr)
|
||||
}
|
||||
} else if o.srv.gateway.enabled {
|
||||
stopAndClearTimer(&o.gwdtmr)
|
||||
}
|
||||
o.mu.Unlock()
|
||||
}
|
||||
|
||||
@@ -2085,7 +2085,9 @@ func (s *Server) jsConsumerLeaderStepDownRequest(sub *subscription, c *client, _
|
||||
}
|
||||
|
||||
// Call actual stepdown.
|
||||
o.raftNode().StepDown()
|
||||
if n := o.raftNode(); n != nil {
|
||||
n.StepDown()
|
||||
}
|
||||
|
||||
resp.Success = true
|
||||
s.sendAPIResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(resp))
|
||||
|
||||
Reference in New Issue
Block a user