1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-03 17:59:31 +02:00

Fix session table cleanup

This commit is contained in:
Alexey Shchepin 2017-11-30 13:31:23 +03:00
parent cf67b9ec54
commit 8639da0e00

View file

@ -111,12 +111,18 @@ handle_cast(_Msg, State) ->
{noreply, State}. {noreply, State}.
handle_info({mnesia_system_event, {mnesia_down, Node}}, State) -> handle_info({mnesia_system_event, {mnesia_down, Node}}, State) ->
ets:select_delete( Sessions =
session, ets:select(
ets:fun2ms( session,
fun(#session{sid = {_, Pid}}) -> ets:fun2ms(
node(Pid) == Node fun(#session{sid = {_, Pid}} = S)
end)), when node(Pid) == Node ->
S
end)),
lists:foreach(
fun(S) ->
mnesia:dirty_delete_object(S)
end, Sessions),
{noreply, State}; {noreply, State};
handle_info(_Info, State) -> handle_info(_Info, State) ->
{noreply, State}. {noreply, State}.