Fix linting errors

This commit is contained in:
2025-02-08 22:29:21 +01:00
parent 1cd56f1525
commit 558d0f4929
3 changed files with 15 additions and 7 deletions

View File

@@ -23,8 +23,8 @@ func New(nc *nats.Conn, b *bus.NotifyBus) (*Server, error) {
return &Server{conn: nc, Subject: DefaultSubject, bus: b}, nil
}
func (s *Server) Close() {
s.conn.Drain()
func (s *Server) Close() error {
return s.conn.Drain()
}
func (s *Server) Start() error {
@@ -59,14 +59,18 @@ func (s *Server) Start() error {
if err := json.Unmarshal(msg.Data(), &bn); err != nil {
slog.Warn("Error unmarshalling message", "error", err)
msg.TermWithReason("failed to decode json")
if err := msg.TermWithReason("failed to decode json"); err != nil {
slog.Error("Error terminating message", "error", err)
}
return
}
id, err := s.bus.Notify(bn)
if err != nil {
slog.Warn("Error sending notification", "error", err)
msg.NakWithDelay(1 * time.Minute)
if err := msg.NakWithDelay(1 * time.Minute); err != nil {
slog.Error("Error naking message", "error", err)
}
return
}
slog.Info("Sent notification", "id", id)