fix(gw): compatible with the max_connection is string type

This commit is contained in:
JianBo He 2022-06-14 19:17:05 +08:00
parent 77d4faa632
commit 78dd9fe247
2 changed files with 7 additions and 2 deletions

View File

@ -90,7 +90,6 @@ fields(sentinel) ->
}}, }},
{sentinel, #{ {sentinel, #{
type => string(), type => string(),
required => true,
desc => ?DESC("sentinel_desc") desc => ?DESC("sentinel_desc")
}} }}
] ++ ] ++

View File

@ -304,7 +304,8 @@ do_listeners_cluster_status(Listeners) ->
Id => #{ Id => #{
node => Node, node => Node,
current_connections => Curr, current_connections => Curr,
max_connections => Max %% XXX: Since it is taken from raw-conf, it is possible a string
max_connections => int(Max)
} }
} }
end, end,
@ -312,6 +313,11 @@ do_listeners_cluster_status(Listeners) ->
Listeners Listeners
). ).
int(B) when is_binary(B) ->
binary_to_integer(B);
int(I) when is_integer(I) ->
I.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Swagger defines %% Swagger defines
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------