Skip to content

Commit 387fa14

Browse files
committed
Use alredy generated hosts list in assignment.
Code review tweaks
1 parent 263481f commit 387fa14

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

cassandra/policies.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ def make_query_plan(self, working_keyspace=None, query=None):
275275
yield host
276276

277277
def on_up(self, host):
278-
279278
# not worrying about threads because this will happen during
280279
# control connection startup/refresh
281280
if not self.local_dc and host.datacenter:
@@ -300,9 +299,9 @@ def on_down(self, host):
300299
if host in current_hosts:
301300
hosts = tuple(h for h in current_hosts if h != host)
302301
if hosts:
303-
self._dc_live_hosts[dc] = tuple(h for h in current_hosts if h != host)
302+
self._dc_live_hosts[dc] = hosts
304303
else:
305-
self._dc_live_hosts.pop(dc, None)
304+
del self._dc_live_hosts[dc]
306305

307306
def on_add(self, host):
308307
self.on_up(host)

0 commit comments

Comments
 (0)