__init__(self,
num_retries,
success_check=lambda r: True,
backoff_start=0,
backoff_growth=2,
save_results=1,
max_wait=60)
(Constructor)
| source code
|
Construct a new RetryLoop.
Arguments:
* num_retries: The maximum number of times to retry the loop if it
doesn't succeed. This means the loop could run at most 1+N times.
* success_check: This is a function that will be called each
time the loop saves a result. The function should return
True if the result indicates loop success, False if it
represents a permanent failure state, and None if the loop
should continue. If no function is provided, the loop will
end as soon as it records any result.
* backoff_start: The number of seconds that must pass before the
loop's second iteration. Default 0, which disables all waiting.
* backoff_growth: The wait time multiplier after each iteration.
Default 2 (i.e., double the wait time each time).
* save_results: Specify a number to save the last N results
that the loop recorded. These records are available through
the results attribute, oldest first. Default 1.
* max_wait: Maximum number of seconds to wait between retries.
|