def get_backoff_time()

in darabonba/core.py [0:0]


    def get_backoff_time(options: RetryOptions, ctx: RetryPolicyContext) -> int:
        ex = ctx.exception
        conditions = options.retry_condition
        for condition in conditions:
            if getattr(ex, 'name', None) not in condition.exception and getattr(ex, 'code', None) not in condition.error_code:
                continue
            max_delay = condition.max_delay or MAX_DELAY_TIME
            retry_after = getattr(ctx.exception, "retry_after", 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