in darabonba/policy/retry.py [0:0]
def get_backoff_delay(options: RetryOptions, ctx: RetryPolicyContext) -> int:
ex = ctx.exception
for condition in options.retry_condition:
if (ex and (ex.name in condition.exception or ex.code in condition.error_code)):
max_delay = condition.max_delay or MAX_DELAY_TIME
retry_after = getattr(ex, 'retryAfter', None)
if retry_after is not None:
return min(retry_after, max_delay)
if not condition.backoff:
return MIN_DELAY_TIME
return min(condition.backoff.get_delay_time(ctx), max_delay)
return MIN_DELAY_TIME