stan broker, fix race on subscribe
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
c55078a1c3
commit
a28169de2e
4
stan.go
4
stan.go
@ -280,9 +280,13 @@ func (n *stanBroker) Publish(topic string, msg *broker.Message, opts ...broker.P
|
||||
}
|
||||
|
||||
func (n *stanBroker) Subscribe(topic string, handler broker.Handler, opts ...broker.SubscribeOption) (broker.Subscriber, error) {
|
||||
n.RLock()
|
||||
if n.conn == nil {
|
||||
n.RUnlock()
|
||||
return nil, errors.New("not connected")
|
||||
}
|
||||
n.RUnlock()
|
||||
|
||||
var ackSuccess bool
|
||||
|
||||
opt := broker.SubscribeOptions{
|
||||
|
Loading…
Reference in New Issue
Block a user