zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29k stars 3.93k forks source link

timeout changed after passing api context to rpc #2518

Open xiaoliao666-1 opened 1 year ago

xiaoliao666-1 commented 1 year ago

api代码 image api context传递 image

rpc context打印 image

api结果

image

rpc结果

image

wsx864321 commented 1 year ago

你当前的context的超时时间只会对当前服务有影响,你在rpc中看到的context的超时时间RpcServerConf中的超时时间,看你的截图猜测应该就是默认的配置的2000ms

Issues-translate-bot commented 1 year ago

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


The timeout time of your current context will only affect the current service. The timeout time of the context you see in the rpc is the timeout time in RpcServerConf. According to your screenshot, it should be the default configuration of 2000ms.

xiaoliao666-1 commented 1 year ago

image 当我配置文件修改了后 image image 依然是没起效果,我的操作问题吗?

Issues-translate-bot commented 1 year ago

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


image When my configuration file is modified image image Still no effect, is there something wrong with my operation?

re-dylan commented 1 year ago

Please put Timeout After ListenOn, like this

image

xiaoliao666-1 commented 1 year ago

timeOut这个值都能拿到但是我的超时还是2s

Issues-translate-bot commented 1 year ago

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


The value of timeOut can be obtained but my timeout is still 2s

Crystalplan commented 1 year ago

遇到同样的超时设置不生效问题,希望得到回答解决,谢谢

Issues-translate-bot commented 1 year ago

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


I encountered the same problem that the timeout setting does not take effect, I hope to get an answer and solve it, thank you

kevwan commented 1 year ago

you need to set timeout in both client and server sides.

hachi-zzq commented 1 year ago

遇到同样的问题,我在RPC 端设置的超时时间是 5s, 假如我不通过 API 调用,而是通过 RPC 其他工具调用,超时的配置是生效的,但是我用 API 调用,超时时间就变成了默认的两秒。

Issues-translate-bot commented 1 year ago

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


Encountered the same problem, the timeout period I set on the RPC side is 5s, if I do not call through the API, but through other RPC tools, the timeout configuration is effective, but if I use the API call, the timeout period becomes The default of two seconds.

github-actions[bot] commented 1 month ago

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