req icon indicating copy to clipboard operation
req copied to clipboard

比隔壁resty性能要好一些

Open feeops opened this issue 5 months ago • 0 comments

简单地测试了一下,比resty性能要好一些

resty实例设置一个超时都要加一下锁

// SetTimeout method is used to set a timeout for a request raised by the client.
//
//	client.SetTimeout(1 * time.Minute)
//
// It can be overridden at the request level. See [Request.SetTimeout]
//
// NOTE: Resty uses [context.WithTimeout] on the request, it does not use [http.Client].Timeout
func (c *Client) SetTimeout(timeout time.Duration) *Client {
	c.lock.Lock()
	defer c.lock.Unlock()
	c.timeout = timeout
	return c
}

feeops avatar Jul 14 '25 02:07 feeops