fix(license): fix crash update license.watermark.

This commit is contained in:
Zhongwen Deng 2022-02-17 15:05:22 +08:00
parent d900418ce2
commit 7853eb75df
1 changed files with 5 additions and 1 deletions

View File

@ -94,6 +94,7 @@ check(_ConnInfo, AckProps) ->
pre_config_update(_, Cmd, Conf) -> pre_config_update(_, Cmd, Conf) ->
{ok, do_update(Cmd, Conf)}. {ok, do_update(Cmd, Conf)}.
post_config_update(_Path, _Cmd, ignore, _Old, _AppEnvs) -> ok;
post_config_update(_Path, _Cmd, NewConf, _Old, _AppEnvs) -> post_config_update(_Path, _Cmd, NewConf, _Old, _AppEnvs) ->
case read_license(NewConf) of case read_license(NewConf) of
{ok, License} -> {ok, License} ->
@ -131,7 +132,10 @@ do_update({key, Content}, _Conf) when is_binary(Content); is_list(Content) ->
#{<<"key">> => Content}; #{<<"key">> => Content};
{error, Reason} -> {error, Reason} ->
erlang:throw(Reason) erlang:throw(Reason)
end. end;
%% We don't do extra action when update license's watermark.
do_update(_Other, _Conf) ->
{ok, ignore}.
check_max_clients_exceeded(MaxClients) -> check_max_clients_exceeded(MaxClients) ->
emqx_license_resources:connection_count() > MaxClients * 1.1. emqx_license_resources:connection_count() > MaxClients * 1.1.