summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-03-11 14:34:09 +0000
committerDavid Baker <dave@matrix.org>2016-03-11 14:34:09 +0000
commitaf59826a2fda31a6382f60659796a1c8db6f21ce (patch)
tree5e0d88003085d6a66f8a3aadf879c3d5293c2825 /synapse/storage
parentDelete old, unused methods and rename new one to just be `user_delete_access_... (diff)
downloadsynapse-af59826a2fda31a6382f60659796a1c8db6f21ce.tar.xz
Make select more sensible when dseleting access tokens, rename pusher deletion to match access token deletion and make exception arg optional.
Diffstat (limited to '')
-rw-r--r--synapse/storage/registration.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 266e29f5bc..3a050621d9 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -198,14 +198,12 @@ class RegistrationStore(SQLBaseStore):
     def user_delete_access_tokens(self, user_id, except_token_ids):
         def f(txn):
             txn.execute(
-                "SELECT id, token FROM access_tokens WHERE user_id = ? LIMIT 50",
-                (user_id,)
+                "SELECT id, token FROM access_tokens "
+                "WHERE user_id = ? AND id not in LIMIT 50",
+                (user_id,except_token_ids)
             )
             rows = txn.fetchall()
             for r in rows:
-                if r[0] in except_token_ids:
-                    continue
-
                 txn.call_after(self.get_user_by_access_token.invalidate, (r[1],))
             txn.execute(
                 "DELETE FROM access_tokens WHERE id in (%s)" % ",".join(