1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 11:50:55 +00:00

fix the retried

This commit is contained in:
astaxie 2017-01-05 18:27:23 +08:00
parent 61e694f388
commit 9266ece7a4

View File

@ -480,7 +480,7 @@ func (b *BeegoHTTPRequest) DoRequest() (resp *http.Response, err error) {
// retries default value is 0, it will run once.
// retries equal to -1, it will run forever until success
// retries is setted, it will retries fixed times.
for i := 0; i == 0 || b.setting.Retries == -1 || i < b.setting.Retries; i++ {
for i := 0; b.setting.Retries == -1 || i <= b.setting.Retries; i++ {
resp, err = client.Do(b.req)
if err == nil {
break