fix 修改重试逻辑

This commit is contained in:
timerzz 2024-07-26 15:22:16 +08:00
parent 597cccf7fa
commit c2339c07c4

View File

@ -38,13 +38,14 @@ func tryRequest(ctx context.Context, urlPath string, respData any, proxyGetter f
} }
resp, 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 { if err != nil {
slog.Debug(err.Error()) slog.Debug(err.Error())
continue continue
} }
if resp.StatusCode() != 200 {
slog.Debug(fmt.Errorf("请求错误:%d, %s", resp.StatusCode(), resp.Body()).Error())
continue
}
return nil return nil
} }
return errors.New("未获取到可用的代理") return errors.New("未获取到可用的代理")