fix sub ctx

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-10-16 16:46:39 +03:00
parent 74b29ac236
commit e20ed5dc32

View File

@ -230,10 +230,11 @@ func (h *httpServer) Deregister() error {
subCtx := h.opts.Context
for sb, subs := range h.subscribers {
if cx := sb.Options().Context; cx != nil {
subCtx = cx
}
for _, sub := range subs {
if cx := sb.Options().Context; cx != nil {
subCtx = cx
}
logger.Infof("Unsubscribing from topic: %s", sub.Topic())
if err := sub.Unsubscribe(subCtx); err != nil {
logger.Errorf("failed to unsubscribe topic: %s, error: %v", sb.Topic(), err)