fix: dialyzer warning

This commit is contained in:
zhongwencool 2022-02-16 16:50:28 +08:00
parent 34fe5082c4
commit 98b2cd683b
2 changed files with 9 additions and 8 deletions

View File

@ -71,14 +71,14 @@ purge() ->
init([LicenseFetcher, CheckInterval]) ->
case LicenseFetcher() of
{ok, License} ->
?LICENSE_TAB = ets:new(?LICENSE_TAB, [set, protected, named_table, read_concurrency]),
?LICENSE_TAB = ets:new(?LICENSE_TAB, [set, protected, named_table, {read_concurrency, true}]),
#{} = check_license(License),
State0 = ensure_check_license_timer(#{check_license_interval => CheckInterval,
license => License}),
State = ensure_check_expiry_timer(State0),
{ok, State};
{error, _} = Error ->
Error
{error, Reason} ->
{stop, Reason}
end.
handle_call({update, License}, _From, State) ->
@ -124,10 +124,11 @@ ensure_check_expiry_timer(State) ->
cancel_timer(State, Key) ->
Ref = maps:get(Key, State),
case is_reference(Ref) of
true -> erlang:cancel_timer(Ref);
false -> ok
end.
_ = case is_reference(Ref) of
true -> erlang:cancel_timer(Ref);
false -> ok
end,
ok.
check_license(License) ->
DaysLeft = days_left(License),

View File

@ -76,7 +76,7 @@ code_change(_OldVsn, State, _Extra) ->
connection_quota_early_alarm() ->
connection_quota_early_alarm(emqx_license_checker:limits()).
connection_quota_early_alarm(#{max_connections := Max}) when is_integer(Max) ->
connection_quota_early_alarm({ok, #{max_connections := Max}}) when is_integer(Max) ->
Count = connection_count(),
Low = emqx_conf:get([license, connection_low_watermark], 0.75),
High = emqx_conf:get([license, connection_high_watermark], 0.80),