Fix the 'route_batch_delete' config

This commit is contained in:
周子博 2018-11-28 15:12:22 +08:00 committed by Feng Lee
parent d08ed351be
commit 5c291ff23e
3 changed files with 4 additions and 4 deletions

View File

@ -1928,7 +1928,7 @@ broker.shared_dispatch_ack_enabled = false
## Enable batch clean for deleted routes.
##
## Value: Flag
broker.route_batch_clean = on
broker.route_batch_clean = off
##--------------------------------------------------------------------
## System Monitor

View File

@ -137,7 +137,7 @@ pick(Topic) ->
init([Pool, Id]) ->
rand:seed(exsplus, erlang:timestamp()),
gproc_pool:connect_worker(Pool, {Pool, Id}),
Batch = #batch{enabled = emqx_config:get_env(route_batch_delete, false),
Batch = #batch{enabled = emqx_config:get_env(route_batch_clean, false),
pending = sets:new()},
{ok, ensure_batch_timer(#state{pool = Pool, id = Id, batch = Batch})}.
@ -191,7 +191,7 @@ handle_cast(Msg, State) ->
{noreply, State}.
handle_info({timeout, _TRef, batch_delete}, State = #state{batch = Batch}) ->
_ = del_direct_routes(Batch#batch.pending),
_ = del_direct_routes(sets:to_list(Batch#batch.pending)),
{noreply, ensure_batch_timer(State#state{batch = ?BATCH(true, sets:new())}), hibernate};
handle_info(Info, State) ->

View File

@ -64,7 +64,7 @@ add_del_route(_) ->
?R:del_route(From, <<"a/b/c">>, node()),
?R:del_route(From, <<"a/+/b">>, node()),
timer:sleep(1),
timer:sleep(120),
?assertEqual([], lists:sort(?R:topics())).
match_routes(_) ->