示例#1
0
文件: pacer.go 项目: kpabba/rclone
// call implements Call but with settable retries
func (p *Pacer) call(fn Paced, retries int) (err error) {
	var retry bool
	for i := 0; i < retries; i++ {
		p.beginCall()
		retry, err = fn()
		p.endCall(retry)
		if !retry {
			break
		}
	}
	if retry {
		err = fs.RetryError(err)
	}
	return err
}
示例#2
0
// call implements Call but with settable retries
func (p *Pacer) call(fn Paced, retries int) (err error) {
	var retry bool
	for i := 1; i <= retries; i++ {
		p.beginCall()
		retry, err = fn()
		p.endCall(retry)
		if !retry {
			break
		}
		fs.Debug("pacer", "low level retry %d/%d (error %v)", i, retries, err)
	}
	if retry {
		err = fs.RetryError(err)
	}
	return err
}