Merge branch 'stable'

This commit is contained in:
Daniil Fedotov 2017-08-31 12:32:39 +01:00
commit 54dcb14fed
4 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,6 @@
PROJECT = rabbitmq_auth_backend_cache
DEPS = rabbit_common
DEPS = rabbit_common rabbit
TEST_DEPS += rabbit rabbitmq_ct_helpers rabbitmq_ct_client_helpers
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk

View File

@ -38,7 +38,7 @@ behaviour_info(_Other) ->
-endif.
expiration(TTL) ->
erlang:system_time(milli_seconds) + TTL.
time_compat:erlang_system_time(milli_seconds) + TTL.
expired(Exp) ->
erlang:system_time(milli_seconds) > Exp.
time_compat:erlang_system_time(milli_seconds) > Exp.

View File

@ -78,7 +78,7 @@ handle_cast(_, State = #state{}) ->
{noreply, State}.
handle_info(gc, State = #state{}) ->
Now = erlang:system_time(milli_seconds),
Now = time_compat:erlang_system_time(milli_seconds),
MatchSpec = [{{'$1', '$2'}, [{'<', '$1', {const, Now}}], ['$2']}],
Expired = ets:select(?SEGMENT_TABLE, MatchSpec),
[ets:delete(Table) || Table <- Expired],
@ -110,7 +110,7 @@ do_add_segment(Segment) ->
end.
get_segment_tables() ->
Now = erlang:system_time(milli_seconds),
Now = time_compat:erlang_system_time(milli_seconds),
MatchSpec = [{{'$1', '$2'}, [{'>', '$1', {const, Now}}], ['$_']}],
[V || {K, V} <- ets:select(?SEGMENT_TABLE, MatchSpec), K =/= segment_size].

View File

@ -75,7 +75,9 @@ init_per_testcase0(_, Config) -> Config.
end_per_testcase(Test, Config) ->
AuthCacheModule = ?config(auth_cache_module, Config),
gen_server:stop(AuthCacheModule),
% gen_server:stop(AuthCacheModule),
Pid = whereis(AuthCacheModule),
exit(Pid, normal),
end_per_testcase0(Test, Config).
end_per_testcase0(get_expired, Config) ->