Compare commits

..

1 Commits

Author SHA1 Message Date
c240631cdb fixup panic
Some checks failed
build / test (push) Failing after 1m32s
codeql / analyze (go) (push) Failing after 2m37s
build / lint (push) Successful in 9m31s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-05-02 10:32:33 +03:00

8
kgo.go
View File

@@ -98,7 +98,9 @@ func (k *Broker) connect(ctx context.Context, opts ...kgo.Opt) (*kgo.Client, err
select { select {
case <-ctx.Done(): case <-ctx.Done():
if ctx.Err() != nil { if ctx.Err() != nil {
sp.SetStatus(tracer.SpanStatusError, ctx.Err().Error()) if sp != nil {
sp.SetStatus(tracer.SpanStatusError, ctx.Err().Error())
}
} }
return nil, ctx.Err() return nil, ctx.Err()
default: default:
@@ -107,7 +109,9 @@ func (k *Broker) connect(ctx context.Context, opts ...kgo.Opt) (*kgo.Client, err
err = c.Ping(ctx) // check connectivity to cluster err = c.Ping(ctx) // check connectivity to cluster
} }
if err != nil { if err != nil {
sp.SetStatus(tracer.SpanStatusError, err.Error()) if sp != nil {
sp.SetStatus(tracer.SpanStatusError, err.Error())
}
return nil, err return nil, err
} }
} }