diff --git a/etc/emqx.conf b/etc/emqx.conf index 1780725cc..7876be59b 100644 --- a/etc/emqx.conf +++ b/etc/emqx.conf @@ -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 diff --git a/src/emqx_router.erl b/src/emqx_router.erl index b1f2e783a..8cd0d4d42 100644 --- a/src/emqx_router.erl +++ b/src/emqx_router.erl @@ -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) -> diff --git a/test/emqx_router_SUITE.erl b/test/emqx_router_SUITE.erl index a35da9c5d..e317ec7b3 100644 --- a/test/emqx_router_SUITE.erl +++ b/test/emqx_router_SUITE.erl @@ -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(_) ->