3535
3636
3737class AuroraInitialConnectionStrategyPlugin (Plugin ):
38- _SUBSCRIBED_METHODS : Set [str ] = {"init_host_provider" ,
39- "connect" ,
40- "force_connect" }
38+ _SUBSCRIBED_METHODS : Set [str ] = {"init_host_provider" , "connect" }
4139
4240 _host_list_provider_service : Optional [HostListProviderService ] = None
4341
@@ -52,29 +50,24 @@ def __init__(self, plugin_service: PluginService):
5250
5351 def connect (self , target_driver_func : Callable , driver_dialect : DriverDialect , host_info : HostInfo , props : Properties ,
5452 is_initial_connection : bool , connect_func : Callable ) -> Connection :
55- return self ._connect (host_info , props , is_initial_connection , connect_func )
56-
57- def force_connect (self , target_driver_func : Callable , driver_dialect : DriverDialect , host_info : HostInfo , props : Properties ,
58- is_initial_connection : bool , force_connect_func : Callable ) -> Connection :
59- return self ._connect (host_info , props , is_initial_connection , force_connect_func )
60-
61- def _connect (self , host_info : HostInfo , props : Properties , is_initial_connection : bool , connect_func : Callable ):
62- type : RdsUrlType = self ._rds_utils .identify_rds_type (host_info .host )
63- if not type .is_rds_cluster :
53+ url_type : RdsUrlType = self ._rds_utils .identify_rds_type (host_info .host )
54+ if not url_type .is_rds_cluster :
6455 return connect_func ()
6556
66- if type == RdsUrlType .RDS_WRITER_CLUSTER :
57+ if url_type == RdsUrlType .RDS_WRITER_CLUSTER :
6758 writer_candidate_conn : Optional [Connection ] = self ._get_verified_writer_connection (props , is_initial_connection , connect_func )
6859 if writer_candidate_conn is None :
6960 return connect_func ()
7061 return writer_candidate_conn
7162
72- if type == RdsUrlType .RDS_READER_CLUSTER :
63+ if url_type == RdsUrlType .RDS_READER_CLUSTER :
7364 reader_candidate_conn : Optional [Connection ] = self ._get_verified_reader_connection (props , is_initial_connection , connect_func )
7465 if reader_candidate_conn is None :
7566 return connect_func ()
7667 return reader_candidate_conn
7768
69+ return connect_func ()
70+
7871 def _get_verified_writer_connection (self , props : Properties , is_initial_connection : bool , connect_func : Callable ) -> Connection | None :
7972 retry_delay_ms : int = WrapperProperties .OPEN_CONNECTION_RETRY_INTERVAL_MS .get_int (props )
8073 end_time_nano = perf_counter_ns () + (WrapperProperties .OPEN_CONNECTION_RETRY_INTERVAL_MS .get_int (props ) * 1000000 )
@@ -84,7 +77,6 @@ def _get_verified_writer_connection(self, props: Properties, is_initial_connecti
8477
8578 while perf_counter_ns () < end_time_nano :
8679 writer_candidate_conn = None
87- writer_candidate = None
8880
8981 try :
9082 writer_candidate = self ._get_writer ()
0 commit comments