fix 修改重试逻辑

This commit is contained in:
timerzz 2024-07-26 14:59:32 +08:00
parent 2ec2db45d8
commit 597cccf7fa

View File

@ -3,14 +3,15 @@ package coach_client
import (
"context"
"fmt"
"log/slog"
"net/url"
"time"
"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"
"github.com/pkg/errors"
proxy2 "github.com/timerzz/proxypool/pkg/proxy"
"log/slog"
"net/url"
"time"
)
type US struct {
@ -36,7 +37,10 @@ func tryRequest(ctx context.Context, urlPath string, respData any, proxyGetter f
default:
}
_, err := callByProxy(ctx, p, urlPath, respData)
resp, err := callByProxy(ctx, p, urlPath, respData)
if resp.StatusCode() != 200 {
err = fmt.Errorf("请求错误:%d, %s", resp.StatusCode(), resp.Body())
}
if err != nil {
slog.Debug(err.Error())
continue