fix: Deregister subscribers

This commit is contained in:
武新飞 2018-12-19 17:56:52 +08:00 committed by Vasiliy Tolstov
parent 7968395d51
commit 3f5cbf2bcd

15
http.go
View File

@ -189,7 +189,20 @@ func (h *httpServer) Deregister() error {
log.Logf("Deregistering node: %s", opts.Name+"-"+opts.Id) log.Logf("Deregistering node: %s", opts.Name+"-"+opts.Id)
service := serviceDef(opts) service := serviceDef(opts)
return opts.Registry.Deregister(service) if err := opts.Registry.Deregister(service); err != nil {
return err
}
h.Lock()
for sb, subs := range h.subscribers {
for _, sub := range subs {
log.Logf("Unsubscribing from topic: %s", sub.Topic())
sub.Unsubscribe()
}
h.subscribers[sb] = nil
}
h.Unlock()
return nil
} }
func (h *httpServer) Start() error { func (h *httpServer) Start() error {