Skip to content

Commit 75d361b

Browse files
committed
policies.py: Remove max reconnect attempts
This was kept this way to preserve legacy behavior, but I think changing the behavior will be less of a problem than what the current behavior causes. The policy is used for reconnections (for example, reconnecting control connection). If reconnect policy finishes generation (it will do so after 64 attempts before my change), then the reconnector finish and the driver won't attempt reconnection anymore. This would be a terrible situation.
1 parent d83adab commit 75d361b

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

cassandra/policies.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ class ConstantReconnectionPolicy(ReconnectionPolicy):
773773
in-between each reconnection attempt.
774774
"""
775775

776-
def __init__(self, delay, max_attempts=64):
776+
def __init__(self, delay, max_attempts=None):
777777
"""
778778
`delay` should be a floating point number of seconds to wait in-between
779779
each attempt.
@@ -807,10 +807,7 @@ class ExponentialReconnectionPolicy(ReconnectionPolicy):
807807
trying to reconnect at exactly the same time.
808808
"""
809809

810-
# TODO: max_attempts is 64 to preserve legacy default behavior
811-
# consider changing to None in major release to prevent the policy
812-
# giving up forever
813-
def __init__(self, base_delay, max_delay, max_attempts=64):
810+
def __init__(self, base_delay, max_delay, max_attempts=None):
814811
"""
815812
`base_delay` and `max_delay` should be in floating point units of
816813
seconds.

0 commit comments

Comments
 (0)