fix: error handling, defer cleanup, graceful shutdown, golangci-lint setup

This commit is contained in:
2026-04-18 17:32:34 +03:00
parent 44cb3c6576
commit ebb8cded41
16 changed files with 174 additions and 47 deletions

View File

@@ -2,6 +2,7 @@ package handler
import (
"context"
"log/slog"
"sync"
"github.com/google/uuid"
@@ -43,7 +44,9 @@ func (h *Hub) Broadcast(orderID uuid.UUID, msg any) {
h.mu.RLock()
defer h.mu.RUnlock()
for _, conn := range h.connections[orderID] {
conn.WriteJSON(msg)
if err := conn.WriteJSON(msg); err != nil {
slog.Error("error while writing json to clients", slog.String("error", err.Error()))
}
}
}