Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(regression): Support deprecated KazooRetry argument #545

Merged
merged 1 commit into from
Dec 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion kazoo/retry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import random
import time
import warnings

from kazoo.exceptions import (
ConnectionClosedError,
Expand Down Expand Up @@ -42,7 +43,7 @@ class KazooRetry(object):
SessionExpiredError,
)

def __init__(self, max_tries=1, delay=0.1, backoff=2,
def __init__(self, max_tries=1, delay=0.1, backoff=2, max_jitter=None,
max_delay=60, ignore_expire=True, sleep_func=time.sleep,
deadline=None, interrupt=None):
"""Create a :class:`KazooRetry` instance for retrying function
Expand All @@ -53,6 +54,8 @@ def __init__(self, max_tries=1, delay=0.1, backoff=2,
:param delay: Initial delay between retry attempts.
:param backoff: Backoff multiplier between retry attempts.
Defaults to 2 for exponential backoff.
:param max_jitter: *Deprecated* Jitter is now uniformly distributed
across retries.
:param max_delay: Maximum delay in seconds, regardless of other
backoff settings. Defaults to one minute.
:param ignore_expire:
Expand All @@ -65,6 +68,12 @@ def __init__(self, max_tries=1, delay=0.1, backoff=2,
between retries.

"""
if max_jitter is not None:
warnings.warn(
'Passing max_jitter to retry configuration is deprecated.'
' Retry jitter is now automacallity uniform across retries.'
' The parameter will be ignored.',
DeprecationWarning, stacklevel=2)
self.max_tries = max_tries
self.delay = delay
self.backoff = backoff
Expand Down