Handle exhausted reconnection schedule correctly
This commit is contained in:
@@ -13,6 +13,7 @@ Bug Fixes
|
|||||||
* Fix duplicate node-up handling, which could result in multiple reconnectors
|
* Fix duplicate node-up handling, which could result in multiple reconnectors
|
||||||
being started as well as the executor threads becoming deadlocked, preventing
|
being started as well as the executor threads becoming deadlocked, preventing
|
||||||
future node up or node down handling from being executed.
|
future node up or node down handling from being executed.
|
||||||
|
* Handle exhausted ReconnectionPolicy schedule correctly
|
||||||
|
|
||||||
Other
|
Other
|
||||||
-----
|
-----
|
||||||
|
@@ -167,9 +167,20 @@ class _ReconnectionHandler(object):
|
|||||||
try:
|
try:
|
||||||
conn = self.try_reconnect()
|
conn = self.try_reconnect()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
next_delay = self.schedule.next()
|
try:
|
||||||
|
next_delay = self.schedule.next()
|
||||||
|
except StopIteration:
|
||||||
|
# the schedule has been exhausted
|
||||||
|
next_delay = None
|
||||||
|
|
||||||
|
# call on_exception for logging purposes even if next_delay is None
|
||||||
if self.on_exception(exc, next_delay):
|
if self.on_exception(exc, next_delay):
|
||||||
self.scheduler.schedule(next_delay, self.run)
|
if next_delay is None:
|
||||||
|
log.warn(
|
||||||
|
"Will not continue to retry reconnection attempts "
|
||||||
|
"due to an exhausted retry schedule")
|
||||||
|
else:
|
||||||
|
self.scheduler.schedule(next_delay, self.run)
|
||||||
else:
|
else:
|
||||||
if not self._cancelled:
|
if not self._cancelled:
|
||||||
self.on_reconnection(conn)
|
self.on_reconnection(conn)
|
||||||
|
Reference in New Issue
Block a user