diff --git a/cmd/api/main.go b/cmd/api/main.go index e5f45a3..d95e766 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -72,7 +72,10 @@ func run(ctx context.Context, w io.Writer, args []string) error { pool.Close() }() - if err := pool.Ping(appCtx); err != nil { + timoutCtx, close := context.WithTimeout(appCtx, 5*time.Second) + defer close() + + if err := pool.Ping(timoutCtx); err != nil { slog.Error("Error in attempting first postgres database connection") return err }