def fill_aliases()

in aws_advanced_python_wrapper/plugin_service.py [0:0]


    def fill_aliases(self, connection: Optional[Connection] = None, host_info: Optional[HostInfo] = None):
        connection = self.current_connection if connection is None else connection
        host_info = self.current_host_info if host_info is None else host_info
        if connection is None or host_info is None:
            return

        if len(host_info.aliases) > 0:
            logger.debug("PluginServiceImpl.NonEmptyAliases", host_info.aliases)
            return

        host_info.add_alias(host_info.as_alias())

        driver_dialect = self._driver_dialect
        try:
            timeout_sec = WrapperProperties.AUXILIARY_QUERY_TIMEOUT_SEC.get(self._props)
            cursor_execute_func_with_timeout = preserve_transaction_status_with_timeout(
                PluginServiceImpl._executor, timeout_sec, driver_dialect, connection)(self._fill_aliases)
            cursor_execute_func_with_timeout(connection, host_info)
        except TimeoutError as e:
            raise QueryTimeoutError(Messages.get("PluginServiceImpl.FillAliasesTimeout")) from e
        except Exception as e:
            # log and ignore
            logger.debug("PluginServiceImpl.FailedToRetrieveHostPort", e)

        host = self.identify_connection(connection)
        if host:
            host_info.add_alias(*host.as_aliases())