Skip to content

Commit ccd7e46

Browse files
committed
Merge pull request apache#327 from thoslin/thoslin-patch-1
Check if max_attempts is None for ConstantReconnectionPolicy
2 parents 49c3549 + 7aa8f30 commit ccd7e46

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

cassandra/policies.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,14 +509,16 @@ def __init__(self, delay, max_attempts=64):
509509
"""
510510
if delay < 0:
511511
raise ValueError("delay must not be negative")
512-
if max_attempts < 0:
512+
if max_attempts is not None and max_attempts < 0:
513513
raise ValueError("max_attempts must not be negative")
514514

515515
self.delay = delay
516516
self.max_attempts = max_attempts
517517

518518
def new_schedule(self):
519-
return repeat(self.delay, self.max_attempts)
519+
if self.max_attempts:
520+
return repeat(self.delay, self.max_attempts)
521+
return repeat(self.delay)
520522

521523

522524
class ExponentialReconnectionPolicy(ReconnectionPolicy):

0 commit comments

Comments
 (0)