fix: elvis problems

This commit is contained in:
Kjell Winblad 2024-02-14 17:43:48 +01:00
parent a153d758c3
commit 4e8dfb48b7
2 changed files with 11 additions and 7 deletions

View File

@ -74,7 +74,8 @@ connector_action_config_to_bridge_v1_config(ConnectorConfig, ActionConfig) ->
), ),
BridgeV1Config4 = maps:put(<<"pool_size">>, PoolSize, BridgeV1Config3), BridgeV1Config4 = maps:put(<<"pool_size">>, PoolSize, BridgeV1Config3),
%% Move the fields stream, partition_key and record_template from parameters in ActionConfig to the top level in BridgeV1Config %% Move the fields stream, partition_key and record_template from
%% parameters in ActionConfig to the top level in BridgeV1Config
lists:foldl( lists:foldl(
fun(Field, Acc) -> fun(Field, Acc) ->
emqx_utils_maps:deep_put( emqx_utils_maps:deep_put(

View File

@ -270,12 +270,7 @@ client_options(Config = #{url := ServerURL, ssl := SSL}) ->
check_status(ConnectorState) -> check_status(ConnectorState) ->
try start_client(ConnectorState) of try start_client(ConnectorState) of
{ok, Client} -> {ok, Client} ->
try hstreamdb_client:echo(Client) of check_status_with_client(Client);
ok -> ok;
{error, _} = ErrorEcho -> ErrorEcho
after
_ = hstreamdb:stop_client(Client)
end;
{error, _} = StartClientError -> {error, _} = StartClientError ->
StartClientError StartClientError
catch catch
@ -283,6 +278,14 @@ check_status(ConnectorState) ->
{error, {ErrorType, Reason}} {error, {ErrorType, Reason}}
end. end.
check_status_with_client(Client) ->
try hstreamdb_client:echo(Client) of
ok -> ok;
{error, _} = ErrorEcho -> ErrorEcho
after
_ = hstreamdb:stop_client(Client)
end.
start_client(Opts) -> start_client(Opts) ->
ClientOptions = maps:get(client_options, Opts), ClientOptions = maps:get(client_options, Opts),
case hstreamdb:start_client(ClientOptions) of case hstreamdb:start_client(ClientOptions) of