server: fix race
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
00439e23f3
commit
fb4d747197
@ -281,14 +281,15 @@ func (n *noopServer) Deregister() error {
|
||||
if sb.Options().Context != nil {
|
||||
cx = sb.Options().Context
|
||||
}
|
||||
|
||||
|
||||
ncx := cx
|
||||
wg.Add(1)
|
||||
go func(s broker.Subscriber) {
|
||||
defer wg.Done()
|
||||
if config.Logger.V(logger.InfoLevel) {
|
||||
config.Logger.Infof(n.opts.Context, "unsubscribing from topic: %s", s.Topic())
|
||||
}
|
||||
if err := s.Unsubscribe(cx); err != nil {
|
||||
if err := s.Unsubscribe(ncx); err != nil {
|
||||
if config.Logger.V(logger.ErrorLevel) {
|
||||
config.Logger.Errorf(n.opts.Context, "unsubscribing from topic: %s err: %v", s.Topic(), err)
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// DefaultServer default server
|
||||
var DefaultServer Server = NewServer()
|
||||
var DefaultServer = NewServer()
|
||||
|
||||
var (
|
||||
// DefaultAddress will be used if no address passed, use secure localhost
|
||||
|
Loading…
Reference in New Issue
Block a user