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
|
||||
}
|
||||
kmsg := kafka.Message{Value: val}
|
||||
if key, ok := options.Context.Value(publishKey{}).([]byte); ok && len(key) > 0 {
|
||||
kmsg.Key = key
|
||||
if options.Context != nil {
|
||||
if key, ok := options.Context.Value(publishKey{}).([]byte); ok && len(key) > 0 {
|
||||
kmsg.Key = key
|
||||
}
|
||||
}
|
||||
|
||||
k.Lock()
|
||||
|
Loading…
Reference in New Issue
Block a user