11import logging
22import random
33import time
4+ import warnings
45
56from kazoo .exceptions import (
67 ConnectionClosedError ,
@@ -42,7 +43,7 @@ class KazooRetry(object):
4243 SessionExpiredError ,
4344 )
4445
45- def __init__ (self , max_tries = 1 , delay = 0.1 , backoff = 2 ,
46+ def __init__ (self , max_tries = 1 , delay = 0.1 , backoff = 2 , max_jitter = None ,
4647 max_delay = 60 , ignore_expire = True , sleep_func = time .sleep ,
4748 deadline = None , interrupt = None ):
4849 """Create a :class:`KazooRetry` instance for retrying function
@@ -53,6 +54,8 @@ def __init__(self, max_tries=1, delay=0.1, backoff=2,
5354 :param delay: Initial delay between retry attempts.
5455 :param backoff: Backoff multiplier between retry attempts.
5556 Defaults to 2 for exponential backoff.
57+ :param max_jitter: *Deprecated* Jitter is now uniformly distributed
58+ across retries.
5659 :param max_delay: Maximum delay in seconds, regardless of other
5760 backoff settings. Defaults to one minute.
5861 :param ignore_expire:
@@ -65,6 +68,12 @@ def __init__(self, max_tries=1, delay=0.1, backoff=2,
6568 between retries.
6669
6770 """
71+ if max_jitter is not None :
72+ warnings .warn (
73+ 'Passing max_jitter to retry configuration is deprecated.'
74+ ' Retry jitter is now automacallity uniform across retries.'
75+ ' The parameter will be ignored.' ,
76+ DeprecationWarning , stacklevel = 2 )
6877 self .max_tries = max_tries
6978 self .delay = delay
7079 self .backoff = backoff
0 commit comments