]> granicus.if.org Git - ejabberd/commitdiff
fix clean redis table
authorHAMANO Tsukasa <hamano@cuspy.org>
Mon, 15 Aug 2016 08:51:06 +0000 (17:51 +0900)
committerHAMANO Tsukasa <hamano@cuspy.org>
Mon, 15 Aug 2016 08:51:06 +0000 (17:51 +0900)
src/ejabberd_sm_redis.erl

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