ugly fix for nil context
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
28190f9489
commit
553fc8b998
@ -177,8 +177,10 @@ func (k *kBroker) Publish(topic string, msg *broker.Message, opts ...broker.Publ
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
kmsg := kafka.Message{Value: val}
|
kmsg := kafka.Message{Value: val}
|
||||||
if key, ok := options.Context.Value(publishKey{}).([]byte); ok && len(key) > 0 {
|
if options.Context != nil {
|
||||||
kmsg.Key = key
|
if key, ok := options.Context.Value(publishKey{}).([]byte); ok && len(key) > 0 {
|
||||||
|
kmsg.Key = key
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
k.Lock()
|
k.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user