From fa4449deb0d2a42c094180a7dde08d94843d17ef Mon Sep 17 00:00:00 2001 From: ziming Date: Wed, 26 Mar 2025 16:39:04 +0800 Subject: [PATCH] ping --- internal/server/http.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/server/http.go b/internal/server/http.go index f48829f..bbe4544 100644 --- a/internal/server/http.go +++ b/internal/server/http.go @@ -14,6 +14,7 @@ import ( "github.com/go-kratos/kratos/v2/transport/http/pprof" "github.com/gorilla/handlers" http2 "net/http" + "time" v1 "voucher/api/v1" "voucher/internal/conf" log2 "voucher/internal/pkg/log" @@ -50,8 +51,9 @@ func buildHTTPServer(c *conf.Bootstrap, accessLogger *log2.AccessLogger, log *lo if c.Server.Http.Addr != "" { opts = append(opts, http.Address(c.Server.Http.Addr)) } + if c.Server.Http.Timeout != nil { - opts = append(opts, http.Timeout(c.Server.Http.Timeout.AsDuration())) + opts = append(opts, http.Timeout(30*time.Second)) } // 允许跨域