Merge pull request #12747 from ieQu1/dev/bulk-ds-kickout

fix(mgmt): Fix bulk kickout of durable sessions
This commit is contained in:
ieQu1 2024-03-20 14:03:20 +01:00 committed by GitHub
commit be88e906a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -205,13 +205,14 @@ destroy(#{clientid := ClientID}) ->
destroy_session(ClientID) ->
session_drop(ClientID, destroy).
-spec kick_offline_session(emqx_types:clientid()) -> ok.
kick_offline_session(ClientID) ->
emqx_cm_locker:trans(
ClientID,
fun(_Nodes) ->
session_drop(ClientID, kicked)
end
).
case emqx_persistent_message:is_persistence_enabled() of
true ->
session_drop(ClientID, kicked);
false ->
ok
end.
%%--------------------------------------------------------------------
%% Info, Stats

View File

@ -376,6 +376,7 @@ kickout_clients(ClientIds) when is_list(ClientIds) ->
emqx_management_proto_v5:kickout_clients(Node, ClientIds)
end,
Results = lists:map(F, emqx:running_nodes()),
lists:foreach(fun emqx_persistent_session_ds:kick_offline_session/1, ClientIds),
case lists:filter(fun(Res) -> Res =/= ok end, Results) of
[] ->
ok;