25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Merge pull request #1245 from hamano/clean_redis_table

fix clean redis table
This commit is contained in:
Evgeny Khramtsov 2016-08-15 15:12:20 +04:00 committed by GitHub
commit 38666cfd58

View File

@ -145,7 +145,10 @@ clean_table() ->
{_, SID} = binary_to_term(USSIDKey), {_, SID} = binary_to_term(USSIDKey),
node(element(2, SID)) == node() node(element(2, SID)) == node()
end, Vals), end, Vals),
Q1 = ["HDEL", ServKey | Vals1], Q1 = case Vals1 of
[] -> [];
_ -> ["HDEL", ServKey | Vals1]
end,
Q2 = lists:map( Q2 = lists:map(
fun(USSIDKey) -> fun(USSIDKey) ->
{US, SID} = binary_to_term(USSIDKey), {US, SID} = binary_to_term(USSIDKey),
@ -153,7 +156,7 @@ clean_table() ->
SIDKey = sid_to_key(SID), SIDKey = sid_to_key(SID),
["HDEL", USKey, SIDKey] ["HDEL", USKey, SIDKey]
end, Vals1), end, Vals1),
Res = ejabberd_redis:qp([Q1|Q2]), Res = ejabberd_redis:qp(lists:delete([], [Q1|Q2])),
case lists:filter( case lists:filter(
fun({ok, _}) -> false; fun({ok, _}) -> false;
(_) -> true (_) -> true