1
1
import logging
2
2
import random
3
3
import time
4
+ import warnings
4
5
5
6
from kazoo .exceptions import (
6
7
ConnectionClosedError ,
@@ -42,7 +43,7 @@ class KazooRetry(object):
42
43
SessionExpiredError ,
43
44
)
44
45
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 ,
46
47
max_delay = 60 , ignore_expire = True , sleep_func = time .sleep ,
47
48
deadline = None , interrupt = None ):
48
49
"""Create a :class:`KazooRetry` instance for retrying function
@@ -53,6 +54,8 @@ def __init__(self, max_tries=1, delay=0.1, backoff=2,
53
54
:param delay: Initial delay between retry attempts.
54
55
:param backoff: Backoff multiplier between retry attempts.
55
56
Defaults to 2 for exponential backoff.
57
+ :param max_jitter: *Deprecated* Jitter is now uniformly distributed
58
+ across retries.
56
59
:param max_delay: Maximum delay in seconds, regardless of other
57
60
backoff settings. Defaults to one minute.
58
61
:param ignore_expire:
@@ -65,6 +68,12 @@ def __init__(self, max_tries=1, delay=0.1, backoff=2,
65
68
between retries.
66
69
67
70
"""
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 )
68
77
self .max_tries = max_tries
69
78
self .delay = delay
70
79
self .backoff = backoff
0 commit comments