- AccessPlatformAPIWithRetry的回调handleResponse添加response参数

- 饿百从网页取门店健康信息
This commit is contained in:
gazebo
2019-06-11 16:39:52 +08:00
parent cae38a9a4c
commit eb009df26d
18 changed files with 261 additions and 32 deletions

View File

@@ -89,7 +89,7 @@ func getClonedData(requestURL *url.URL, r *bytes.Buffer) string {
return retVal
}
func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.Request, config *APIConfig, handleResponse func(bodyMap map[string]interface{}) (string, error)) error {
func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.Request, config *APIConfig, handleResponse func(response *http.Response, bodyMap map[string]interface{}) (string, error)) error {
exceedLimitRetryCount := 0
recoverableErrorRetryCount := 0
for {
@@ -155,7 +155,7 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
if err != nil {
errLevel = ErrLevelRecoverableErr // 读取数据错误,或数据格式错误认为是偶发情况,重试
} else {
errLevel, err = handleResponse(bodyMap)
errLevel, err = handleResponse(response, bodyMap)
}
if err == nil {
return nil