resolve conflict

This commit is contained in:
Денис Евстигнеев 2024-12-19 13:36:55 +03:00 committed by devstigneev
parent 7c5da60556
commit 1ba02ed8ad
3 changed files with 6 additions and 8 deletions

View File

@ -10,7 +10,6 @@ linters:
- unused
- gosimple
- govet
- goimports
- prealloc
- unconvert
- nakedret

View File

@ -10,11 +10,10 @@ import (
type event struct {
msg *broker.Message
err error
ctx context.Context
topic string
ctx context.Context
sync.RWMutex
ack bool
}

10
kgo.go
View File

@ -57,16 +57,16 @@ var DefaultRetryBackoffFn = func() func(int) time.Duration {
}()
type Broker struct {
c *kgo.Client
c *kgo.Client
connected *atomic.Uint32
kopts []kgo.Opt
subs []*subscriber
subs []*Subscriber
opts broker.Options
sync.RWMutex
init bool
init bool
}
func (r *Broker) Live() bool {
@ -305,7 +305,7 @@ func (k *Broker) publish(ctx context.Context, msgs []*broker.Message, opts ...br
k.opts.Meter.Summary(semconv.PublishMessageLatencyMicroseconds, "endpoint", rec.Topic, "topic", rec.Topic).Update(te.Seconds())
k.opts.Meter.Histogram(semconv.PublishMessageDurationSeconds, "endpoint", rec.Topic, "topic", rec.Topic).Update(te.Seconds())
// if err != nil {
k.opts.Meter.Counter(semconv.PublishMessageTotal, "endpoint", rec.Topic, "topic", rec.Topic, "status", "failure").Inc()
k.opts.Meter.Counter(semconv.PublishMessageTotal, "endpoint", rec.Topic, "topic", rec.Topic, "status", "failure").Inc()
// } else {
k.opts.Meter.Counter(semconv.PublishMessageTotal, "endpoint", rec.Topic, "topic", rec.Topic, "status", "success").Inc()
// }
@ -325,7 +325,7 @@ func (k *Broker) publish(ctx context.Context, msgs []*broker.Message, opts ...br
k.opts.Meter.Counter(semconv.PublishMessageTotal, "endpoint", result.Record.Topic, "topic", result.Record.Topic, "status", "failure").Inc()
errs = append(errs, result.Err.Error())
} // else {
k.opts.Meter.Counter(semconv.PublishMessageTotal, "endpoint", result.Record.Topic, "topic", result.Record.Topic, "status", "success").Inc()
k.opts.Meter.Counter(semconv.PublishMessageTotal, "endpoint", result.Record.Topic, "topic", result.Record.Topic, "status", "success").Inc()
// }
}