Unlock only on return

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2021-03-18 11:38:04 -07:00
parent d32f3ce479
commit 4f2b701eb5

View File

@@ -606,11 +606,11 @@ func (mset *stream) addConsumerWithAssignment(config *ConsumerConfig, oname stri
// Check in place here for interest. Will setup properly in setLeader.
r := o.acc.sl.Match(o.cfg.DeliverSubject)
if !o.hasDeliveryInterest(len(r.psubs)+len(r.qsubs) > 0) {
mset.mu.Unlock()
// Directs can let the interest come to us eventually, but setup delete timer.
if config.Direct {
o.updateDeliveryInterest(false)
} else {
mset.mu.Unlock()
o.deleteWithoutAdvisory()
return nil, errNoInterest
}