Skip to content

Commit 70feb84

Browse files
Call on_add before distance to properly initialize lbp
In DC aware lbp when local_dc is not provided we set it in on_add and it needs to be initialized for distance to give proper results.
1 parent 1143477 commit 70feb84

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cassandra/cluster.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,14 +2016,14 @@ def on_add(self, host, refresh_nodes=True):
20162016

20172017
log.debug("Handling new host %r and notifying listeners", host)
20182018

2019+
self.profile_manager.on_add(host)
2020+
self.control_connection.on_add(host, refresh_nodes)
2021+
20192022
distance = self.profile_manager.distance(host)
20202023
if distance != HostDistance.IGNORED:
20212024
self._prepare_all_queries(host)
20222025
log.debug("Done preparing queries for new host %r", host)
20232026

2024-
self.profile_manager.on_add(host)
2025-
self.control_connection.on_add(host, refresh_nodes)
2026-
20272027
if distance == HostDistance.IGNORED:
20282028
log.debug("Not adding connection pool for new host %r because the "
20292029
"load balancing policy has marked it as IGNORED", host)

0 commit comments

Comments
 (0)