增加重试配置初始化 + 重试逻辑处理

This commit is contained in:
2024-05-31 18:51:31 +08:00
parent 0ba0f7dced
commit 196e81191a
4 changed files with 44 additions and 3 deletions

View File

@ -36,7 +36,7 @@ type Request struct {
//
// Date : 12:26 2024/5/31
type RequestRetryRule struct {
RetryCount int64 `json:"retry_count"` // 重试次数
RetryCount int `json:"retry_count"` // 重试次数
RetryTimeInterval int64 `json:"retry_time_interval"` // 重试的时间间隔 1 - 10 之间, 单位毫秒
RetryHttpCodeList []int64 `json:"retry_http_code_list"` // 哪些http状态码需要重试
RetryBusinessCodeList []string `json:"retry_business_code_list"` // 哪些业务状态码需要重试

View File

@ -7,6 +7,8 @@
// Date : 2024-05-31 12:34
package define
import "github.com/go-resty/resty/v2"
// Response 响应的数据结构定义
//
// Author : go_developer@163.com<白茶清欢>
@ -26,4 +28,8 @@ type Response struct {
RequestStartTime int64 `json:"request_start_time"` // 请求开始时间 : ms
FinishRequestTime int64 `json:"finish_request_time"` // 请求完成时间 : ms
UsedTime int64 `json:"used_time"` // 请求耗时 : ms
RestyResponse *resty.Response `json:"-"` // 请求返回
IsSuccess bool `json:"is_success"` // 是否请求成功
RequestCount int64 `json:"request_count"` // 请求次数
FailInfoList []any `json:"fail_info_list"` // 请求失败信息记录
}