优化日志输出,修复重试机制问题
This commit is contained in:
@@ -89,6 +89,7 @@ func stopChannels(ctx context.Context, curr time.Time) error {
|
|||||||
}
|
}
|
||||||
ids[i] = int32(id)
|
ids[i] = int32(id)
|
||||||
}
|
}
|
||||||
|
slog.Debug("stopChannels", slog.String("result", strings.Join(result, ",")))
|
||||||
|
|
||||||
// 删除过期的 channel
|
// 删除过期的 channel
|
||||||
body, err := json.Marshal(map[string]any{
|
body, err := json.Marshal(map[string]any{
|
||||||
@@ -112,7 +113,9 @@ func stopChannels(ctx context.Context, curr time.Time) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func(Body io.ReadCloser) {
|
||||||
|
_ = Body.Close()
|
||||||
|
}(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
body, err := io.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
|
|||||||
@@ -263,8 +263,8 @@ func (c *cloud) requestCloud(method string, url string, data string) (*http.Resp
|
|||||||
req.Header.Set("Content-Type", "application/json")
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
|
||||||
var resp *http.Response
|
var resp *http.Response
|
||||||
for range 2 {
|
for i := 0; i < 2; i++ {
|
||||||
token, err := c.token(false)
|
token, err := c.token(i == 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -289,7 +289,7 @@ func (c *cloud) requestCloud(method string, url string, data string) (*http.Resp
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
fmt.Println("==============================")
|
fmt.Println("------------------------------")
|
||||||
fmt.Println(string(str))
|
fmt.Println(string(str))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,7 +546,7 @@ func (c *gateway) requestGateway(method string, url string, data string) (*http.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
fmt.Println("==============================")
|
fmt.Println("------------------------------")
|
||||||
fmt.Println(string(str))
|
fmt.Println(string(str))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user