fix: ecpool worker exec dynamo health check fun
This commit is contained in:
parent
65f468f706
commit
d0f0a93888
|
@ -31,8 +31,7 @@
|
||||||
connect/1,
|
connect/1,
|
||||||
do_get_status/1,
|
do_get_status/1,
|
||||||
do_async_reply/2,
|
do_async_reply/2,
|
||||||
worker_do_query/4,
|
worker_do_query/4
|
||||||
worker_do_get_status/1
|
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-import(hoconsc, [mk/2, enum/1, ref/2]).
|
-import(hoconsc, [mk/2, enum/1, ref/2]).
|
||||||
|
@ -165,18 +164,14 @@ on_get_status(_InstanceId, #{poolname := Pool}) ->
|
||||||
Health = emqx_plugin_libs_pool:health_check_ecpool_workers(Pool, fun ?MODULE:do_get_status/1),
|
Health = emqx_plugin_libs_pool:health_check_ecpool_workers(Pool, fun ?MODULE:do_get_status/1),
|
||||||
status_result(Health).
|
status_result(Health).
|
||||||
|
|
||||||
do_get_status(Conn) ->
|
do_get_status(_Conn) ->
|
||||||
%% because the dynamodb driver connection process is the ecpool worker self
|
%% because the dynamodb driver connection process is the ecpool worker self
|
||||||
%% so we must call the checker function inside the worker
|
%% so we must call the checker function inside the worker
|
||||||
ListTables = ecpool_worker:exec(Conn, {?MODULE, worker_do_get_status, []}, infinity),
|
case erlcloud_ddb2:list_tables() of
|
||||||
case ListTables of
|
|
||||||
{ok, _} -> true;
|
{ok, _} -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
worker_do_get_status(_) ->
|
|
||||||
erlcloud_ddb2:list_tables().
|
|
||||||
|
|
||||||
status_result(_Status = true) -> connected;
|
status_result(_Status = true) -> connected;
|
||||||
status_result(_Status = false) -> connecting.
|
status_result(_Status = false) -> connecting.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue