- try to fix EOF bug when accessing wenxi api.
This commit is contained in:
@@ -80,8 +80,8 @@ func AccessPlatformAPIWithRetry(client *http.Client, request *http.Request, conf
|
||||
if err != nil {
|
||||
baseapi.SugarLogger.Debugf("AccessPlatformAPIWithRetry client.Get return err:%v", err)
|
||||
err, ok := err.(net.Error)
|
||||
recoverableErrorRetryCount++
|
||||
if ok && err.Timeout() && recoverableErrorRetryCount <= config.MaxRecoverableRetryCount {
|
||||
recoverableErrorRetryCount++
|
||||
continue
|
||||
} else {
|
||||
baseapi.SugarLogger.Errorf("AccessPlatformAPIWithRetry access api request:%v, error:%v", request, err)
|
||||
|
||||
@@ -97,6 +97,7 @@ func (a *API) AccessAPI(action string, params map[string]interface{}, body strin
|
||||
} else {
|
||||
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(body))
|
||||
}
|
||||
request.Close = true // todo try to fix EOF error when accessing weixin api.
|
||||
err = platformapi.AccessPlatformAPIWithRetry(a.client, request, a.config, func(response *http.Response) (result string, err error) {
|
||||
jsonResult1, err := utils.HTTPResponse2Json(response)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user