Merge pull request #8901 from JimMoen/fix-bridge-api
- for connectors using ecpool, parse connect error `Reason` when start pool failed. - Refine InfluxDB bridge desc.
This commit is contained in:
commit
0336b935a0
|
@ -532,6 +532,17 @@ lookup_from_local_node(BridgeType, BridgeName) ->
|
||||||
{200};
|
{200};
|
||||||
{error, timeout} ->
|
{error, timeout} ->
|
||||||
{503, error_msg('SERVICE_UNAVAILABLE', <<"request timeout">>)};
|
{503, error_msg('SERVICE_UNAVAILABLE', <<"request timeout">>)};
|
||||||
|
{error, {start_pool_failed, Name, Reason}} ->
|
||||||
|
{503,
|
||||||
|
error_msg(
|
||||||
|
'SERVICE_UNAVAILABLE',
|
||||||
|
bin(
|
||||||
|
io_lib:format(
|
||||||
|
"failed to start ~p pool for reason ~p",
|
||||||
|
[Name, Reason]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
{500, error_msg('INTERNAL_ERROR', Reason)}
|
{500, error_msg('INTERNAL_ERROR', Reason)}
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,12 +40,13 @@ start_pool(Name, Mod, Options) ->
|
||||||
stop_pool(Name),
|
stop_pool(Name),
|
||||||
start_pool(Name, Mod, Options);
|
start_pool(Name, Mod, Options);
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
|
NReason = parse_reason(Reason),
|
||||||
?SLOG(error, #{
|
?SLOG(error, #{
|
||||||
msg => "start_ecpool_error",
|
msg => "start_ecpool_error",
|
||||||
pool_name => Name,
|
pool_name => Name,
|
||||||
reason => Reason
|
reason => NReason
|
||||||
}),
|
}),
|
||||||
{error, {start_pool_failed, Name, Reason}}
|
{error, {start_pool_failed, Name, NReason}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
stop_pool(Name) ->
|
stop_pool(Name) ->
|
||||||
|
@ -86,3 +87,11 @@ health_check_ecpool_workers(PoolName, CheckFunc, Timeout) when is_function(Check
|
||||||
exit:timeout ->
|
exit:timeout ->
|
||||||
false
|
false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
parse_reason({
|
||||||
|
{shutdown, {failed_to_start_child, _, {shutdown, {failed_to_start_child, _, Reason}}}},
|
||||||
|
_
|
||||||
|
}) ->
|
||||||
|
Reason;
|
||||||
|
parse_reason(Reason) ->
|
||||||
|
Reason.
|
||||||
|
|
|
@ -65,7 +65,7 @@ TLDR: </br>
|
||||||
desc_type {
|
desc_type {
|
||||||
desc {
|
desc {
|
||||||
en: """The Bridge Type."""
|
en: """The Bridge Type."""
|
||||||
zh: """Bridge 类型。"""
|
zh: """桥接类型。"""
|
||||||
}
|
}
|
||||||
label {
|
label {
|
||||||
en: "Bridge Type"
|
en: "Bridge Type"
|
||||||
|
@ -75,12 +75,12 @@ TLDR: </br>
|
||||||
|
|
||||||
desc_name {
|
desc_name {
|
||||||
desc {
|
desc {
|
||||||
en: """Bridge name, used as a human-readable description of the bridge."""
|
en: """Bridge name."""
|
||||||
zh: """桥接名字,人类可读的描述信息。"""
|
zh: """桥接名称。"""
|
||||||
}
|
}
|
||||||
label {
|
label {
|
||||||
en: "Bridge Name"
|
en: "Bridge Name"
|
||||||
zh: "桥接名字"
|
zh: "桥接名称"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue