fix
This commit is contained in:
@@ -19,9 +19,10 @@ func NewClient(ctx context.Context, c *Config) Client {
|
||||
// 创建一个restry客户端
|
||||
client := resty.New().SetBaseURL(c.BaseUrl)
|
||||
|
||||
// 设置超时时间为 1 分钟
|
||||
client.SetTimeout(1 * time.Minute)
|
||||
|
||||
// 设置超时时间为 5 分钟
|
||||
if c.RequireTimeout == 0 {
|
||||
client.SetTimeout(5 * time.Minute)
|
||||
}
|
||||
/* 传输链路 */
|
||||
tracer := otel.GetTracerProvider().Tracer(trace.TraceName)
|
||||
spanCtx, span := tracer.Start(
|
||||
@@ -60,11 +61,12 @@ func NewClient(ctx context.Context, c *Config) Client {
|
||||
|
||||
type (
|
||||
Config struct {
|
||||
BaseUrl string `json:"base_url"`
|
||||
Url string `json:"url"`
|
||||
HeaderData map[string]string `json:"header_data"`
|
||||
RetryCount int64 `json:"retry_count"`
|
||||
RetryWaitTime int64 `json:"retry_wait_time"`
|
||||
BaseUrl string `json:"base_url"`
|
||||
Url string `json:"url"`
|
||||
HeaderData map[string]string `json:"header_data"`
|
||||
RetryCount int64 `json:"retry_count"`
|
||||
RetryWaitTime int64 `json:"retry_wait_time"`
|
||||
RequireTimeout time.Duration `json:"require_timeout"`
|
||||
}
|
||||
defaultClient struct {
|
||||
c *Config
|
||||
|
||||
Reference in New Issue
Block a user