feat: API replicas over HAProxy (3)

This commit is contained in:
2026-11-06 03:26:54 +03:00
parent de2f63b926
commit ec111aadfb
32 changed files with 396 additions and 147 deletions
+4 -1
View File
@@ -2,8 +2,11 @@ package handler
import (
"context"
"fmt"
"net/http"
"time"
"messenger/internal/domain"
)
const readyTimeout = time.Second
@@ -17,7 +20,7 @@ func (h *Handler) Ready(w http.ResponseWriter, r *http.Request) {
defer cancel()
for _, dep := range h.deps {
if err := dep(ctx); err != nil {
h.fail(w, r, err)
h.fail(w, r, fmt.Errorf("%w: %v", domain.ErrUnavailable, err))
return
}
}