fix(action/source api): improve returned error message on timeout
This commit is contained in:
parent
3013189cd7
commit
f17aefe3d7
|
@ -1151,7 +1151,18 @@ post_config_update([ConfRootKey, BridgeType, BridgeName], _Req, NewConf, undefin
|
||||||
post_config_update([ConfRootKey, BridgeType, BridgeName], _Req, NewConf, OldConf, _AppEnvs) when
|
post_config_update([ConfRootKey, BridgeType, BridgeName], _Req, NewConf, OldConf, _AppEnvs) when
|
||||||
ConfRootKey =:= ?ROOT_KEY_ACTIONS; ConfRootKey =:= ?ROOT_KEY_SOURCES
|
ConfRootKey =:= ?ROOT_KEY_ACTIONS; ConfRootKey =:= ?ROOT_KEY_SOURCES
|
||||||
->
|
->
|
||||||
ok = uninstall_bridge_v2(ConfRootKey, BridgeType, BridgeName, OldConf),
|
case uninstall_bridge_v2(ConfRootKey, BridgeType, BridgeName, OldConf) of
|
||||||
|
ok ->
|
||||||
|
ok;
|
||||||
|
{error, timeout} ->
|
||||||
|
throw(<<
|
||||||
|
"Timed out trying to remove action or source. Please try again and,"
|
||||||
|
" if the error persists, try disabling the connector before retrying."
|
||||||
|
>>);
|
||||||
|
{error, not_found} ->
|
||||||
|
%% Should not happen, unless config is inconsistent.
|
||||||
|
throw(<<"Referenced connector not found">>)
|
||||||
|
end,
|
||||||
ok = install_bridge_v2(ConfRootKey, BridgeType, BridgeName, NewConf),
|
ok = install_bridge_v2(ConfRootKey, BridgeType, BridgeName, NewConf),
|
||||||
Bridges = emqx_utils_maps:deep_put(
|
Bridges = emqx_utils_maps:deep_put(
|
||||||
[BridgeType, BridgeName], emqx:get_config([ConfRootKey]), NewConf
|
[BridgeType, BridgeName], emqx:get_config([ConfRootKey]), NewConf
|
||||||
|
|
|
@ -879,6 +879,8 @@ handle_disable_enable(ConfRootKey, Id, Enable) ->
|
||||||
?SERVICE_UNAVAILABLE(<<"request timeout">>);
|
?SERVICE_UNAVAILABLE(<<"request timeout">>);
|
||||||
{error, timeout} ->
|
{error, timeout} ->
|
||||||
?SERVICE_UNAVAILABLE(<<"request timeout">>);
|
?SERVICE_UNAVAILABLE(<<"request timeout">>);
|
||||||
|
{error, Reason} when is_binary(Reason) ->
|
||||||
|
?BAD_REQUEST(Reason);
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?INTERNAL_ERROR(Reason)
|
?INTERNAL_ERROR(Reason)
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Now, when attempting to stop a connector, if such operation times out, we forcefully shut down the connector process.
|
||||||
|
|
||||||
|
Error messages when attempting to disable an action/source when its underlying connector is stuck were also improved.
|
Loading…
Reference in New Issue