~fddlZddlmZddlmZmZmZmZmZm Z m Z ddl m Z m Z e dZerddlmZGddZy) N)sleep) TYPE_CHECKINGAnyCallableIterableTupleTypeTypeVar)ConnectionError TimeoutErrorT)AbstractBackoffc eZdZdZeeejffdddede e e dffdZ de e e d d fd Zd egefd ee gefd efdZy )Retryz0Retry a specific number of times after a failurebackoffrretriessupported_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. N)_backoff_retries_supported_errors)selfrrrs T/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/redis/retry.py__init__zRetry.__init__s"   !1specified_errorsreturnNcbtt|jt|z|_y)zM Updates the supported errors with the specified error types N)tuplesetr)rrs rupdate_supported_errorszRetry.update_supported_errors%s* "' &&/?)@@ A" rdofailc6|jjd} |S#|j$rb}|dz }|||jdk\r||jkDr||jj |}|dkDr t |Yd}~nd}~wwxYw})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  #t )) #A U ==A%(T]]*BK--//9Q;'N #s&BABB)__name__ __module__ __qualname____doc__r r sockettimeoutintrr Exceptionrrr!rr rr*rrrr s:   NN9 2"22 Y 45 2* (i 9  # RUO# {C'(# #rr)r/timertypingrrrrrr r redis.exceptionsr r r redis.backoffrrr3rrr8s0 OOO: CL-9#9#r