@@ -124,7 +124,7 @@ def populate_opened_connection_set(self, host_info: HostInfo, conn: Connection):
124124 aliases : FrozenSet [str ] = host_info .as_aliases ()
125125
126126 if self ._rds_utils .is_rds_instance (host_info .host ):
127- self ._track_connection (host_info .as_alias () , conn )
127+ self ._track_connection (host_info .url , conn )
128128 return
129129
130130 instance_endpoint : Optional [str ] = next (
@@ -133,6 +133,7 @@ def populate_opened_connection_set(self, host_info: HostInfo, conn: Connection):
133133 logger .debug ("OpenedConnectionTracker.UnableToPopulateOpenedConnectionSet" )
134134 return
135135
136+ instance_endpoint = instance_endpoint if instance_endpoint .endswith ("/" ) else instance_endpoint + "/"
136137 self ._track_connection (instance_endpoint , conn )
137138
138139 def invalidate_all_connections (self , host_info : Optional [HostInfo ] = None , host : Optional [FrozenSet [str ]] = None ):
@@ -144,7 +145,7 @@ def invalidate_all_connections(self, host_info: Optional[HostInfo] = None, host:
144145 """
145146
146147 if host_info :
147- self .invalidate_all_connections (host = frozenset ([host_info .as_alias () ]))
148+ self .invalidate_all_connections (host = frozenset ([host_info .url ]))
148149 self .invalidate_all_connections (host = host_info .as_aliases ())
149150 return
150151
@@ -160,6 +161,8 @@ def invalidate_all_connections(self, host_info: Optional[HostInfo] = None, host:
160161 if not instance_endpoint :
161162 return
162163
164+ instance_endpoint = instance_endpoint if instance_endpoint .endswith ("/" ) else instance_endpoint + "/"
165+
163166 with self ._lock :
164167 connection_set : Optional [WeakSet ] = self ._opened_connections .get (instance_endpoint )
165168 connections_list = list (connection_set ) if connection_set is not None else None
@@ -173,14 +176,16 @@ def remove_connection_tracking(self, host_info: HostInfo, connection: Connection
173176 return
174177
175178 if self ._rds_utils .is_rds_instance (host_info .host ):
176- host = host_info .as_alias ()
179+ host = host_info .url
177180 else :
178181 host = next ((alias for alias in host_info .as_aliases ()
179182 if self ._rds_utils .is_rds_instance (self ._rds_utils .remove_port (alias ))), "" )
180183
181184 if not host :
182185 return
183186
187+ host = host if host .endswith ("/" ) else host + "/"
188+
184189 with self ._lock :
185190 connection_set = self ._opened_connections .get (host )
186191 if connection_set :
0 commit comments