forked from mtusi2026/mtusi2026lab3
feat: add checks and limits for 4 grade
This commit is contained in:
@@ -119,7 +119,8 @@ func readyHandler(health *services.HealthService) http.HandlerFunc {
|
||||
writeError(w, 405, "method_not_allowed", "method not allowed", requestID)
|
||||
return
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(r.Context(), 2*time.Second)
|
||||
// Readiness must finish before HAProxy's one-second check read timeout.
|
||||
ctx, cancel := context.WithTimeout(r.Context(), 500*time.Millisecond)
|
||||
defer cancel()
|
||||
if err := health.Ready(ctx); err != nil {
|
||||
writeError(w, 503, "unavailable", "dependency unavailable", requestID)
|
||||
|
||||
Reference in New Issue
Block a user