go-zero
go-zero copied to clipboard
Gateway timeout configuration
Describe the bug
- GatewayConf.Timeout如果要设置超时,在yaml格式的配置文件中,该怎么写? 我试了写8s, 8000都不可以。
- GatewayConf.Timeout 和 GatewayConf.RestConf.Timeout 冲突了,因为RestConf是匿名的。这个无法通过配置文件配置了。只能在代码里面写。 2.1 GateConf.Timeout的生效位置是在使用grpcurl.InvokeRPC()的时候,使用这个参数构建了一个Timeout Context。 GatewayConf.RestConf.Timeout的生效位置有两个,一个是基于此参数配置了原生http.Server的ReadTimeout和WriteTimeout,另外一个是在http的Server端的http超时拦截器中。
我测试过,如果我们的业务逻辑处理时间超过GatewayConf.Timeout 或者 超过 GatewayConf.RestConf.Timeout,都会出现504的错误
To Reproduce Steps to reproduce the behavior, if applicable:
-
The code is
-
The error is
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Environments (please complete the following information):
- OS: Linux
- go-zero version 1.4.0
- goctl version [e.g. 1.2.1, optional]
More description Add any other context about the problem here.
I have the same confusion.
This issue is stale because it has been open for 30 days with no activity.
配置超时时间未生效,该如何解决
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
The configured timeout does not take effect, what should I do?