Fix realization retry parameters

Increase max wait to 10 seconds and fix random conditional

Change-Id: I881d09735ec36a4bccbdfa46b8ac8d46d9389507
This commit is contained in:
Anna Khmelnitsky 2019-07-15 10:53:30 -07:00
parent 09f15ab42c
commit 7cb343cba5
1 changed files with 4 additions and 3 deletions

View File

@ -184,12 +184,13 @@ def retry_random_upon_exception(exc, delay=0.5, max_delay=5,
before=_log_before_retry, after=_log_after_retry)
def retry_upon_none_result(max_attempts, delay=0.5, max_delay=2, random=False):
def retry_upon_none_result(max_attempts, delay=0.5, max_delay=10,
random=False):
if random:
wait_func = tenacity.wait_exponential(
wait_func = tenacity.wait_random_exponential(
multiplier=delay, max=max_delay)
else:
wait_func = tenacity.wait_random_exponential(
wait_func = tenacity.wait_exponential(
multiplier=delay, max=max_delay)
return tenacity.retry(reraise=True,
retry=tenacity.retry_if_result(lambda x: x is None),