Avoid lock to server with client lock held

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2018-06-12 12:55:50 -07:00
parent 844f376140
commit 4fb84e229c

View File

@@ -1129,8 +1129,7 @@ func (c *client) unsubscribe(sub *subscription) {
// tries to deliver us a message. Remote queue subscribers are directed
// so we need to know what to do to avoid unnecessary message drops
// from [auto-]unsubscribe.
if c.typ == CLIENT && c.srv != nil &&
len(sub.queue) > 0 && c.srv.NumRoutes() > 0 {
if c.typ == CLIENT && c.srv != nil && len(sub.queue) > 0 {
c.srv.holdRemoteQSub(sub)
}
}