- handle sometimes ebai return 400, can be recovered by retry.
This commit is contained in:
@@ -123,7 +123,14 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
|
||||
baseapi.SugarLogger.Infof("AccessPlatformAPIWithRetry:%s access api too slow, url:%v, request:%v, usedMilliSecond:%d", trackID, request.URL, getClonedData(request.URL, savedBuf), usedMilliSecond)
|
||||
}
|
||||
defer response.Body.Close()
|
||||
if response.StatusCode != 200 {
|
||||
if response.StatusCode != http.StatusOK {
|
||||
// todo, hardcode,暂时在这里处理饿百的访问异常
|
||||
if response.StatusCode == http.StatusBadRequest && request.URL.Hostname() == "api-be.ele.me" {
|
||||
recoverableErrorRetryCount++
|
||||
if recoverableErrorRetryCount <= config.MaxRecoverableRetryCount {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if bodyData, err := ioutil.ReadAll(response.Body); err == nil {
|
||||
baseapi.SugarLogger.Infof("AccessPlatformAPIWithRetry:%s HTTP code is:%d, url:%v, request:%v, response:%s", trackID, response.StatusCode, request.URL, getClonedData(request.URL, savedBuf), string(bodyData))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user