2121from time import perf_counter_ns
2222from typing import TYPE_CHECKING , Dict , Optional
2323
24+ from aws_advanced_python_wrapper .errors import AwsWrapperError
2425from aws_advanced_python_wrapper .host_availability import HostAvailability
2526from aws_advanced_python_wrapper .hostinfo import HostInfo , Topology
2627from aws_advanced_python_wrapper .utils import services_container
@@ -344,8 +345,8 @@ def _open_any_connection_and_update_topology(self) -> Topology:
344345 self ._cluster_id , self ._initial_host_info .host )
345346
346347 try :
347- writer_id = self ._topology_utils .get_writer_host_if_connected (
348- conn , self ._plugin_service .driver_dialect )
348+ writer_id = self ._topology_utils .get_writer_id_if_connected (
349+ conn , self ._plugin_service .driver_dialect )
349350 if writer_id :
350351 self ._is_verified_writer_connection = True
351352 writer_verified_by_this_thread = True
@@ -354,9 +355,10 @@ def _open_any_connection_and_update_topology(self) -> Topology:
354355 writer_host_info = self ._initial_host_info
355356 self ._writer_host_info .set (writer_host_info )
356357 else :
357- writer_host = self ._instance_template .host .replace ("?" , writer_id )
358- port = self ._instance_template .port \
359- if self ._instance_template .is_port_specified () \
358+ instance_template = self ._get_instance_template (writer_id , conn )
359+ writer_host = instance_template .host .replace ("?" , writer_id )
360+ port = instance_template .port \
361+ if instance_template .is_port_specified () \
360362 else self ._initial_host_info .port
361363 writer_host_info = HostInfo (
362364 writer_host ,
0 commit comments