feat 请求超时返回错误
This commit is contained in:
parent
53c6ee15ff
commit
38f473928f
@ -2,6 +2,7 @@ package coach_client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitea.timerzz.com/kedaya_haitao/common/pkg/proxy"
|
||||
restry_pool "gitea.timerzz.com/kedaya_haitao/common/pkg/restry-pool"
|
||||
"github.com/go-resty/resty/v2"
|
||||
@ -27,6 +28,9 @@ func tryRequest(ctx context.Context, urlPath string, respData any, proxyGetter f
|
||||
for p := proxyGetter(); p != nil; p = proxyGetter() {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
|
||||
return fmt.Errorf("超时未获取到结果,链接:%s", urlPath)
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user