Merge pull request #8926 from HJianBo/using-erlang-system-time-5

fix(time): replace os:system_time with erlang:system_time
This commit is contained in:
JianBo He 2022-09-13 09:09:16 +08:00 committed by GitHub
commit 0bac4e200e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 5 deletions

View File

@ -8,6 +8,7 @@
* Speed up dispatching of shared subscription messages in a cluster [#8893](https://github.com/emqx/emqx/pull/8893) * Speed up dispatching of shared subscription messages in a cluster [#8893](https://github.com/emqx/emqx/pull/8893)
* Fix the extra / prefix when CoAP gateway parsing client topics. [#8658](https://github.com/emqx/emqx/pull/8658) * Fix the extra / prefix when CoAP gateway parsing client topics. [#8658](https://github.com/emqx/emqx/pull/8658)
* Speed up updating the configuration, When some nodes in the cluster are down. [#8857](https://github.com/emqx/emqx/pull/8857) * Speed up updating the configuration, When some nodes in the cluster are down. [#8857](https://github.com/emqx/emqx/pull/8857)
* Fix delayed publish inaccurate caused by os time change. [#8926](https://github.com/emqx/emqx/pull/8926)
* Fix that EMQX can't start when the retainer is disabled [#8911](https://github.com/emqx/emqx/pull/8911) * Fix that EMQX can't start when the retainer is disabled [#8911](https://github.com/emqx/emqx/pull/8911)
## Enhancements ## Enhancements

View File

@ -399,7 +399,7 @@ do_verify(JWT, [JWK | More], VerifyClaims) ->
end. end.
verify_claims(Claims, VerifyClaims0) -> verify_claims(Claims, VerifyClaims0) ->
Now = os:system_time(seconds), Now = erlang:system_time(seconds),
VerifyClaims = VerifyClaims =
[ [
{<<"exp">>, fun(ExpireTime) -> {<<"exp">>, fun(ExpireTime) ->

View File

@ -296,7 +296,7 @@ handle_cast(Msg, State) ->
%% Do Publish... %% Do Publish...
handle_info({timeout, TRef, do_publish}, State = #{publish_timer := TRef}) -> handle_info({timeout, TRef, do_publish}, State = #{publish_timer := TRef}) ->
DeletedKeys = do_publish(mnesia:dirty_first(?TAB), os:system_time(seconds)), DeletedKeys = do_publish(mnesia:dirty_first(?TAB), erlang:system_time(seconds)),
lists:foreach(fun(Key) -> mria:dirty_delete(?TAB, Key) end, DeletedKeys), lists:foreach(fun(Key) -> mria:dirty_delete(?TAB, Key) end, DeletedKeys),
{noreply, ensure_publish_timer(State#{publish_timer := undefined, publish_at := 0})}; {noreply, ensure_publish_timer(State#{publish_timer := undefined, publish_at := 0})};
handle_info(stats, State = #{stats_fun := StatsFun}) -> handle_info(stats, State = #{stats_fun := StatsFun}) ->
@ -347,12 +347,12 @@ ensure_publish_timer(State) ->
ensure_publish_timer('$end_of_table', State) -> ensure_publish_timer('$end_of_table', State) ->
State#{publish_timer := undefined, publish_at := 0}; State#{publish_timer := undefined, publish_at := 0};
ensure_publish_timer({Ts, _Id}, State = #{publish_timer := undefined}) -> ensure_publish_timer({Ts, _Id}, State = #{publish_timer := undefined}) ->
ensure_publish_timer(Ts, os:system_time(seconds), State); ensure_publish_timer(Ts, erlang:system_time(seconds), State);
ensure_publish_timer({Ts, _Id}, State = #{publish_timer := TRef, publish_at := PubAt}) when ensure_publish_timer({Ts, _Id}, State = #{publish_timer := TRef, publish_at := PubAt}) when
Ts < PubAt Ts < PubAt
-> ->
ok = emqx_misc:cancel_timer(TRef), ok = emqx_misc:cancel_timer(TRef),
ensure_publish_timer(Ts, os:system_time(seconds), State); ensure_publish_timer(Ts, erlang:system_time(seconds), State);
ensure_publish_timer(_Key, State) -> ensure_publish_timer(_Key, State) ->
State. State.

View File

@ -1,7 +1,7 @@
%% -*- mode: erlang -*- %% -*- mode: erlang -*-
{application, emqx_modules, [ {application, emqx_modules, [
{description, "EMQX Modules"}, {description, "EMQX Modules"},
{vsn, "5.0.3"}, {vsn, "5.0.4"},
{modules, []}, {modules, []},
{applications, [kernel, stdlib, emqx]}, {applications, [kernel, stdlib, emqx]},
{mod, {emqx_modules_app, []}}, {mod, {emqx_modules_app, []}},