Skip to content

Commit d8a6356

Browse files
committed
fix(health): increase timeout for readiness check to 10 seconds
1 parent fb9d854 commit d8a6356

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

backend/server/health_handler.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package server
22

33
import (
44
"context"
5+
"fmt"
56
"net/http"
67
"time"
78

@@ -52,7 +53,7 @@ func (s *Server) LivenessHandler(c echo.Context) error {
5253
// @Success 200 {object} HealthResponse "Service is ready or not"
5354
// @Router /health/readiness [get]
5455
func (s *Server) ReadinessHandler(c echo.Context) error {
55-
ctx, cancel := context.WithTimeout(c.Request().Context(), 500*time.Millisecond)
56+
ctx, cancel := context.WithTimeout(c.Request().Context(), 10*time.Second)
5657
defer cancel()
5758

5859
dbStatus := StatusDown
@@ -61,6 +62,8 @@ func (s *Server) ReadinessHandler(c echo.Context) error {
6162
if _, err := s.store.GetTimestamp(ctx); err == nil {
6263
dbStatus = StatusUp
6364
httpStatus = http.StatusOK
65+
} else {
66+
fmt.Println(err.Error())
6467
}
6568
stat := s.store.Stat()
6669

0 commit comments

Comments
 (0)