Make select more sensible when dseleting access tokens, rename pusher deletion to match access token deletion and make exception arg optional.

This commit is contained in:
David Baker 2016-03-11 14:34:09 +00:00
parent f523177850
commit af59826a2f
3 changed files with 5 additions and 7 deletions

View file

@ -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(