Skip to content

Commit b31038a

Browse files
committed
[lint] minor fixes
1 parent 56b30fe commit b31038a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

internal/sms-gateway/handlers/middlewares/userauth/userauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func NewCode(authSvc *auth.Service) fiber.Handler {
8787
// It returns true if the Locals contain a user under the key LocalsUser,
8888
// otherwise returns false.
8989
func HasUser(c *fiber.Ctx) bool {
90-
return c.Locals(localsUser) != nil
90+
return GetUser(c) != nil
9191
}
9292

9393
// GetUser returns the user stored in the Locals under the key LocalsUser.

internal/sms-gateway/modules/sse/service.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,20 @@ func (s *Service) handleStream(deviceID string, w *bufio.Writer) {
147147
for {
148148
select {
149149
case event := <-conn.channel:
150+
success := true
150151
s.metrics.ObserveEventDeliveryLatency(func() {
151152
if err := s.writeToStream(w, fmt.Sprintf("event: %s\ndata: %s", event.name, utils.UnsafeString(event.data))); err != nil {
152153
s.logger.Warn("Failed to write event data",
153154
zap.String("device_id", deviceID),
154155
zap.String("connection_id", conn.id),
155156
zap.Error(err))
156-
return
157+
success = false
157158
}
158159
})
160+
161+
if !success {
162+
return
163+
}
159164
// Conditionally handle ticker events
160165
case <-tickerChan:
161166
if err := s.writeToStream(w, ":keepalive"); err != nil {

0 commit comments

Comments
 (0)