Revert "fix: api group set timeout: 0s not working." (#4931)

This commit is contained in:
Kevin Wan
2025-06-08 23:14:38 +08:00
committed by GitHub
parent 19fec36d24
commit 0f2b589d4d
5 changed files with 17 additions and 29 deletions

View File

@@ -62,8 +62,8 @@ func (ng *engine) addRoutes(r featuredRoutes) {
// need to guarantee the timeout is the max of all routes
// otherwise impossible to set http.Server.ReadTimeout & WriteTimeout
if r.timeout != nil {
ng.timeout = *r.timeout
if r.timeout > ng.timeout {
ng.timeout = r.timeout
}
}
@@ -192,9 +192,9 @@ func (ng *engine) checkedMaxBytes(bytes int64) int64 {
return ng.conf.MaxBytes
}
func (ng *engine) checkedTimeout(timeout *time.Duration) time.Duration {
if timeout != nil {
return *timeout
func (ng *engine) checkedTimeout(timeout time.Duration) time.Duration {
if timeout > 0 {
return timeout
}
return time.Duration(ng.conf.Timeout) * time.Millisecond