From 25437adf02d23eae9c09eb7fb3324d6289bcf598 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Tue, 23 May 2023 14:06:40 -0300 Subject: [PATCH] fix(webhook): fix empty ehttpc worker list clause on health check (r5.0) Fixes https://emqx.atlassian.net/browse/EMQX-9970 --- apps/emqx_connector/src/emqx_connector_http.erl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/emqx_connector/src/emqx_connector_http.erl b/apps/emqx_connector/src/emqx_connector_http.erl index bb822a60a..4a9cb345f 100644 --- a/apps/emqx_connector/src/emqx_connector_http.erl +++ b/apps/emqx_connector/src/emqx_connector_http.erl @@ -416,7 +416,9 @@ resolve_pool_worker(#{pool_name := PoolName} = State, Key) -> on_get_status(_InstId, #{pool_name := PoolName, connect_timeout := Timeout} = State) -> case do_get_status(PoolName, Timeout) of ok -> - {connected, State}; + connected; + {error, still_connecting} -> + connecting; {error, Reason} -> {disconnected, State, Reason} end. @@ -438,7 +440,8 @@ do_get_status(PoolName, Timeout) -> end end, try emqx_utils:pmap(DoPerWorker, Workers, Timeout) of - % we crash in case of non-empty lists since we don't know what to do in that case + [] -> + {error, still_connecting}; [_ | _] = Results -> case [E || {error, _} = E <- Results] of [] ->