b|ddlmZddlmZmZmZmZmZmZm Z ddl m Z m Z m Z erddlmZe dZGddZy) )sleep) TYPE_CHECKINGAny AwaitableCallableTupleTypeTypeVar)ConnectionError RedisError TimeoutError)AbstractBackoffTc |eZdZdZdZeeffdddedee e dffdZ d e fd Z d egeefd ee gefd efdZy)Retryz0Retry a specific number of times after a failure_backoff_retries_supported_errorsbackoffrretriessupported_errors.c.||_||_||_y)a' Initialize a `Retry` object with a `Backoff` object that retries a maximum of `retries` times. `retries` can be negative to retry forever. You can specify the types of supported errors which trigger a retry with the `supported_errors` parameter. Nr)selfrrrs 5/usr/lib/python3/dist-packages/redis/asyncio/retry.py__init__zRetry.__init__s    !1specified_errorscbtt|jt|z|_y)zM Updates the supported errors with the specified error types N)tuplesetr)rrs rupdate_supported_errorszRetry.update_supported_errors&s*"' &&/?)@@ A" rdofailreturncvK|jjd} |d{S7#|j$rt}|dz }||d{7|jdk\r||jkDr||jj |}|dkDrt |d{7Yd}~nd}~wwxYww)a& Execute an operation that might fail and returns its result, or raise the exception that was thrown depending on the `Backoff` object. `do`: the operation to call. Expects no argument. `fail`: the failure handler, expects the last error that was thrown rN)rresetrrcomputer)rr#r$failureserrorrs rcall_with_retryzRetry.call_with_retry.s  )Tz!z)) )A 5k!!==A%(T]]*BK--//9Q;.(( )sPB9 202B92B5B0AAB0%B(&B0+B90B55B9N)__name__ __module__ __qualname____doc__ __slots__r r intrr r rlistr"rrrrr,rrrr s:;I  : 2"22 Z 0# 56 2(  )2y|+,)4r9s2PPPFF- CL6)6)r