server: fix race in noop server #117

Merged
vtolstov merged 1 commits from race into v3 2022-04-15 15:53:18 +03:00

View File

@ -277,7 +277,7 @@ func (n *noopServer) Deregister() error {
wg := sync.WaitGroup{}
for sb, subs := range n.subscribers {
for _, sub := range subs {
for idx := range subs {
if sb.Options().Context != nil {
cx = sb.Options().Context
}
@ -293,7 +293,7 @@ func (n *noopServer) Deregister() error {
config.Logger.Errorf(n.opts.Context, "unsubscribing from topic: %s err: %v", s.Topic(), err)
}
}
}(sub)
}(subs[idx])
}
n.subscribers[sb] = nil
}