You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "578157900 (via GitHub)" <gi...@apache.org> on 2023/04/14 03:34:48 UTC

[GitHub] [dubbo-go] 578157900 commented on issue #2302: restful protocol transport dial cause io timeout

578157900 commented on issue #2302:
URL: https://github.com/apache/dubbo-go/issues/2302#issuecomment-1507880268

   `
   func NewRestyClient(restOption *client.RestOptions) client.RestClient {
   	client := resty.New()
   	client.SetTransport(
   		&http.Transport{
   			DialContext: (&net.Dialer{
   				Timeout: restOption.ConnectTimeout,
   			}).DialContext,
   			IdleConnTimeout: 90 * time.Second,
   		}).SetTimeout(restOption.RequestTimeout)
   	return &RestyClient{
   		client: client,
   	}
   }
   `
   1. 通过配置IdleConnTimeout超时来回收空闲链接。
   2. 通过client.SetTimeout来设置每次请求的超时时间。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org