- record access time
This commit is contained in:
@@ -88,6 +88,7 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
|
||||
if request.Body != nil {
|
||||
request.Body = ioutil.NopCloser(io.TeeReader(request.Body, savedBuf))
|
||||
}
|
||||
beginTime := time.Now()
|
||||
response, err := client.Do(request)
|
||||
if err != nil {
|
||||
baseapi.SugarLogger.Debugf("AccessPlatformAPIWithRetry client.Get return err:%v", err)
|
||||
@@ -100,6 +101,10 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
|
||||
return ErrAPIAccessFailed
|
||||
}
|
||||
}
|
||||
usedMilliSecond := time.Now().Sub(beginTime) / time.Millisecond
|
||||
if usedMilliSecond > 5000 {
|
||||
baseapi.SugarLogger.Infof("AccessPlatformAPIWithRetry access api too slow, url:%v, request:%v, usedMilliSecond:%d", request.URL, getClonedData(savedBuf), usedMilliSecond)
|
||||
}
|
||||
defer response.Body.Close()
|
||||
if response.StatusCode != 200 {
|
||||
if bodyData, err := ioutil.ReadAll(response.Body); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user