Skip to content

Commit f50355f

Browse files
committed
fix: fallback to default port
1 parent d1e5625 commit f50355f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

aws_advanced_python_wrapper/simple_read_write_splitting_plugin.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,11 @@ def is_reader_host(self, current_host: HostInfo) -> bool:
231231
def _create_host_info(self, endpoint: str, role: HostRole) -> HostInfo:
232232
endpoint = endpoint.strip()
233233
host = endpoint
234-
port = self._plugin_service.database_dialect.default_port if not self._plugin_service.current_host_info.is_port_specified() \
235-
else self._plugin_service.current_host_info.port
234+
try:
235+
port = self._plugin_service.database_dialect.default_port if not self._plugin_service.current_host_info.is_port_specified() \
236+
else self._plugin_service.current_host_info.port
237+
except AwsWrapperError: # if current_host_info cannot be determined fallback to default port
238+
port = self._plugin_service.database_dialect.default_port
236239
colon_index = endpoint.rfind(":")
237240

238241
if colon_index != -1:

tests/integration/container/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def pytest_runtest_setup(item):
140140
CustomEndpointPlugin._monitors.clear()
141141
CustomEndpointMonitor._custom_endpoint_info_cache.clear()
142142
MonitoringThreadContainer.clean_up()
143+
ConnectionProviderManager.release_resources()
143144

144145
ConnectionProviderManager.reset_provider()
145146
DatabaseDialectManager.reset_custom_dialect()

0 commit comments

Comments
 (0)