Skip to content

Commit b10a3a2

Browse files
fix: stale dns plugin when connected to reader (#1086)
1 parent fb2a3ac commit b10a3a2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

aws_advanced_python_wrapper/stale_dns_plugin.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def get_verified_connection(self, is_initial_connection: bool, host_list_provide
7676
if cluster_inet_address is None:
7777
return conn
7878

79-
if self._plugin_service.get_host_role(conn) == HostRole.READER:
79+
connected_to_reader = self._plugin_service.get_host_role(conn) == HostRole.READER
80+
if connected_to_reader:
8081
# This if-statement is only reached if the connection url is a writer cluster endpoint.
8182
# If the new connection resolves to a reader instance, this means the topology is outdated.
8283
# Force refresh to update the topology.
@@ -109,7 +110,7 @@ def get_verified_connection(self, is_initial_connection: bool, host_list_provide
109110
if self._writer_host_address is None:
110111
return conn
111112

112-
if self._writer_host_address != cluster_inet_address:
113+
if self._writer_host_address != cluster_inet_address or connected_to_reader:
113114
logger.debug("StaleDnsHelper.StaleDnsDetected", self._writer_host_info)
114115

115116
allowed_hosts = self._plugin_service.hosts

0 commit comments

Comments
 (0)