fix(connector): fix crash in health checking of mongo connection
This commit is contained in:
parent
6b1ec4f035
commit
261ca3d625
|
@ -169,8 +169,13 @@ health_check(PoolName) ->
|
|||
case ecpool_worker:client(Worker) of
|
||||
{ok, Conn} ->
|
||||
%% we don't care if this returns something or not, we just to test the connection
|
||||
Res = mongo_api:find_one(Conn, <<"foo">>, {}, #{}),
|
||||
Res == undefined orelse is_map(Res);
|
||||
try mongo_api:find_one(Conn, <<"foo">>, {}, #{}) of
|
||||
undefined -> true;
|
||||
Res when is_map(Res) -> true;
|
||||
_ -> false
|
||||
catch
|
||||
_Class:_Error -> false
|
||||
end;
|
||||
_ -> false
|
||||
end
|
||||
end || {_WorkerName, Worker} <- ecpool:workers(PoolName)],
|
||||
|
|
Loading…
Reference in New Issue