mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Fix consumer info if consumer was closed (#4610)
Co-authored-by: Derek Collison <derek@nats.io> Signed-off-by: Tomasz Pietrek <tomasz@nats.io> Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -2493,7 +2493,7 @@ func (o *consumer) infoWithSnap(snap bool) *ConsumerInfo {
|
||||
func (o *consumer) infoWithSnapAndReply(snap bool, reply string) *ConsumerInfo {
|
||||
o.mu.Lock()
|
||||
mset := o.mset
|
||||
if mset == nil || mset.srv == nil {
|
||||
if o.closed || mset == nil || mset.srv == nil {
|
||||
o.mu.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -4286,7 +4286,13 @@ func (s *Server) jsConsumerInfoRequest(sub *subscription, c *client, _ *Account,
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
resp.ConsumerInfo = obs.info()
|
||||
|
||||
if resp.ConsumerInfo = obs.info(); resp.ConsumerInfo == nil {
|
||||
// This consumer returned nil which means it's closed. Respond with not found.
|
||||
resp.Error = NewJSConsumerNotFoundError()
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
s.sendAPIResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(resp))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user