RetryParams的min_retries的目的是什么?

时间:2015-01-05 18:46:46

标签: python google-cloud-storage

在RetryParams文档中,有min_retries和max_retries参数。我可以理解有一个max_retries参数,但不确定具有min_retries的意义。文档(https://cloud.google.com/appengine/docs/python/googlecloudstorageclient/retryparams_class)显示以下内容:

min_retries
The minimum number of times to retry.
max_retries
The maximum number of times to retry. Set this value to 0 if you don't want any retries.

如果我将max_retries设置为10,我希望如果连接重复失败,它将尝试最多10次。为什么需要min_retries参数?什么时候会发挥作用?

2 个答案:

答案 0 :(得分:2)

从该文档页面:

max_retry_period
The maximum number of seconds that can be spent on all retries of a given request. Retry stops when this period passed AND min_retries has been attempted.

答案 1 :(得分:1)

来自appengine-docs

" [..]这将继续,直到请求成功,retryMaxAttempts,或两者 retryMinAttempts totalRetryPeriodMillis已经过去。[。 ]"

用我自己的话说:你的请求需要一段时间,直到它失败,你可以用两个参数来限制重复请求的总时间和/或重复请求的数量,无论第一个请求是什么。 让我们说你想确保(重复)请求不会超过10秒,但你想在任何情况下至少有2次重复请求,即使在这种情况下需要超过10秒。

相关问题