Skip to content

Commit

Permalink
fix: correct lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Feb 12, 2024
1 parent bf2ccc1 commit d01ffa6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions internal/infra/http/handler/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ func (h Event) Receive(c *fiber.Ctx) error {

{
ctx, span := h.Tracer.Start(ctx, "handler.event.publish", trace.WithSpanKind(trace.SpanKindProducer))
defer span.End()

if err := h.CMQ.Publish(ctx, rq.ID, data); err != nil {
span.RecordError(err)

return fiber.NewError(http.StatusServiceUnavailable, err.Error())
}

span.End()
}

return c.Status(http.StatusOK).Send(nil)
Expand Down
7 changes: 3 additions & 4 deletions internal/infra/output/mqtt/mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package mqtt

import (
"context"
"fmt"
"os"
"runtime"
"time"
Expand Down Expand Up @@ -53,10 +52,10 @@ func (p *MQTT) options() *mqtt.ClientOptions {
opts.SetPingTimeout(PingTimeout)
opts.SetAutoReconnect(true)
opts.SetMaxReconnectInterval(ReconnectInterval)
opts.SetConnectionLostHandler(func(c mqtt.Client, err error) {
opts.SetConnectionLostHandler(func(_ mqtt.Client, err error) {
p.logger.Error("mqtt connection lost", zap.Error(err))
})
opts.SetReconnectingHandler(func(c mqtt.Client, options *mqtt.ClientOptions) {
opts.SetReconnectingHandler(func(_ mqtt.Client, _ *mqtt.ClientOptions) {
p.logger.Debug("mqtt reconnect")
})

Expand Down Expand Up @@ -111,7 +110,7 @@ func (p *MQTT) Run() {
ctx := trace.ContextWithSpanContext(context.Background(), e.SpanContext)
_, span := p.tracer.Start(ctx, "channels.mqtt")

p.client.Publish(fmt.Sprintf("saf/%s", e.Subject), 1, true, e.Payload)
p.client.Publish("saf/"+e.Subject, 1, true, e.Payload)

span.End()
}
Expand Down

0 comments on commit d01ffa6

Please sign in to comment.