diff --git a/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl b/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl index a148a4d16..fd522726f 100644 --- a/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl +++ b/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl @@ -252,6 +252,7 @@ start_pool(PoolName, PoolOpts) -> {error, {already_started, _}} -> ?SLOG(warning, #{ msg => "emqx_connector_on_start_already_started", + connector => PoolName, pool_name => PoolName }), ok; @@ -510,8 +511,8 @@ resolve_pool_worker(#{pool_name := PoolName} = State, Key) -> on_get_channels(ResId) -> emqx_bridge_v2:get_channels_for_connector(ResId). -on_get_status(_InstId, #{pool_name := PoolName, connect_timeout := Timeout} = State) -> - case do_get_status(PoolName, Timeout) of +on_get_status(InstId, #{pool_name := InstId, connect_timeout := Timeout} = State) -> + case do_get_status(InstId, Timeout) of ok -> connected; {error, still_connecting} -> @@ -527,12 +528,7 @@ do_get_status(PoolName, Timeout) -> case ehttpc:health_check(Worker, Timeout) of ok -> ok; - {error, Reason} = Error -> - ?SLOG(error, #{ - msg => "http_connector_get_status_failed", - reason => redact(Reason), - worker => Worker - }), + {error, _} = Error -> Error end end, @@ -543,14 +539,20 @@ do_get_status(PoolName, Timeout) -> case [E || {error, _} = E <- Results] of [] -> ok; - Errors -> - hd(Errors) + [{error, Reason} | _] -> + ?SLOG(info, #{ + msg => "health_check_failed", + reason => redact(Reason), + connector => PoolName + }), + {error, Reason} end catch exit:timeout -> - ?SLOG(error, #{ - msg => "http_connector_pmap_failed", - reason => timeout + ?SLOG(info, #{ + msg => "health_check_failed", + reason => timeout, + connector => PoolName }), {error, timeout} end.