Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
c240631cdb |
4
kgo.go
4
kgo.go
@@ -98,8 +98,10 @@ 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 {
|
||||||
|
if sp != nil {
|
||||||
sp.SetStatus(tracer.SpanStatusError, ctx.Err().Error())
|
sp.SetStatus(tracer.SpanStatusError, ctx.Err().Error())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil, ctx.Err()
|
return nil, ctx.Err()
|
||||||
default:
|
default:
|
||||||
c, err = kgo.NewClient(opts...)
|
c, err = kgo.NewClient(opts...)
|
||||||
@@ -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 {
|
||||||
|
if sp != nil {
|
||||||
sp.SetStatus(tracer.SpanStatusError, err.Error())
|
sp.SetStatus(tracer.SpanStatusError, err.Error())
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user