go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

Gateway timeout configuration

Open chazex opened this issue 2 years ago • 4 comments

Describe the bug

  1. GatewayConf.Timeout如果要设置超时,在yaml格式的配置文件中,该怎么写? 我试了写8s, 8000都不可以。
  2. 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:

  1. The code is

    
    
  2. 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.

chazex avatar Nov 15 '22 08:11 chazex

I have the same confusion.

cloook avatar Mar 24 '23 02:03 cloook

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Mar 27 '24 01:03 github-actions[bot]

配置超时时间未生效,该如何解决

jaronnie avatar May 08 '24 05:05 jaronnie

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The configured timeout does not take effect, what should I do?

Issues-translate-bot avatar May 08 '24 05:05 Issues-translate-bot