aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/views/api/bot/user.py
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-05-15 20:17:53 +0100
committerGravatar Gareth Coles <[email protected]>2018-05-15 20:17:53 +0100
commit10ddcbea3732b1c066458aea533480f2bb399ef5 (patch)
treeef721816385f4e049bd3271f7824bbfbe85285d7 /pysite/views/api/bot/user.py
parentMain site redirects should be 302s (diff)
Add snowflake index on oauth_data and use it for deletions
We were using id previously, but that was no longer the correct key
Diffstat (limited to 'pysite/views/api/bot/user.py')
-rw-r--r--pysite/views/api/bot/user.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pysite/views/api/bot/user.py b/pysite/views/api/bot/user.py
index 077991f5..58963682 100644
--- a/pysite/views/api/bot/user.py
+++ b/pysite/views/api/bot/user.py
@@ -52,7 +52,7 @@ class UserView(APIView, DBMixin):
all_oauth_data = self.db.run(self.db.query(self.oauth_table_name), coerce=list)
for item in all_oauth_data:
- if item["id"] not in user_ids:
+ if item["snowflake"] not in user_ids:
self.db.delete(self.oauth_table_name, item["id"], durability="soft")
oauth_deletions += 1
@@ -94,7 +94,7 @@ class UserView(APIView, DBMixin):
oauth_deletions = self.db.run(
self.db.query(self.oauth_table_name)
- .get_all(*user_ids)
+ .get_all(*user_ids, index="snowflake")
.delete()
).get("deleted", 0)