Merge pull request #7931 from HJianBo/gw-fixes

Increase the wait time to get the error of creating authn
This commit is contained in:
JianBo He 2022-05-13 10:10:34 +08:00 committed by GitHub
commit bcac65310b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 13 deletions

View File

@ -87,7 +87,9 @@ update(Pid, Config) ->
call(Pid, {update, Config}).
call(Pid, Req) ->
gen_server:call(Pid, Req, 5000).
%% The large timeout aim to get the modified results of the dependent
%% resources
gen_server:call(Pid, Req, 15000).
%%--------------------------------------------------------------------
%% gen_server callbacks

View File

@ -167,16 +167,17 @@ start_grpc_server(GwName, Options = #{bind := ListenOn}) ->
)}
]
end,
ListenOnStr = emqx_listeners:format_addr(ListenOn),
case grpc:start_server(GwName, ListenOn, Services, SvrOptions) of
{ok, _SvrPid} ->
console_print(
"Start ~ts gRPC server on ~p successfully.~n",
[GwName, ListenOn]
"Start ~ts gRPC server on ~s successfully.~n",
[GwName, ListenOnStr]
);
{error, Reason} ->
?ELOG(
"Failed to start ~ts gRPC server on ~p, reason: ~0p",
[GwName, ListenOn, Reason]
"Failed to start ~ts gRPC server on ~s, reason: ~0p",
[GwName, ListenOnStr, Reason]
),
throw(
{badconf, #{

View File

@ -211,9 +211,7 @@ t_gateway_exproto_with_ssl(_) ->
name => <<"exproto">>,
server => #{
bind => <<"9100">>,
ssl => SslSvrOpts#{
enable => true
}
ssl => SslSvrOpts
},
handler => #{
address => <<"http://127.0.0.1:9001">>,
@ -230,7 +228,7 @@ t_gateway_exproto_with_ssl(_) ->
GwConf2 = emqx_map_lib:deep_merge(GwConf, #{
server => #{
bind => <<"9200">>,
ssl => SslCliOpts#{enable => true}
ssl => SslCliOpts
}
}),
{200, _} = request(put, "/gateway/exproto", maps:without([name, listeners], GwConf2)),

View File

@ -862,10 +862,12 @@ format_channel_info({_, ClientInfo0, ClientStats}) ->
],
TimesKeys = [created_at, connected_at, disconnected_at],
%% format timestamp to rfc3339
lists:foldl(
fun result_format_time_fun/2,
maps:without(RemoveList, ClientInfoMap),
TimesKeys
result_format_undefined_to_null(
lists:foldl(
fun result_format_time_fun/2,
maps:without(RemoveList, ClientInfoMap),
TimesKeys
)
).
%% format func helpers
@ -884,6 +886,15 @@ result_format_time_fun(Key, NClientInfoMap) ->
NClientInfoMap
end.
result_format_undefined_to_null(Map) ->
maps:map(
fun
(_, undefined) -> null;
(_, V) -> V
end,
Map
).
-spec peername_dispart(emqx_types:peername()) -> {binary(), inet:port_number()}.
peername_dispart({Addr, Port}) ->
AddrBinary = list_to_binary(inet:ntoa(Addr)),