summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2018-05-09 14:54:28 +0100
committerDavid Baker <dave@matrix.org>2018-05-09 14:54:28 +0100
commit7e8726b8fb297f255ed1fd78f8e3be1d7f21dcc7 (patch)
tree738d19f4e4933ee761d2f3e6636b3c5940348c19 /synapse/storage
parentPart user from rooms on account deactivate (diff)
downloadsynapse-7e8726b8fb297f255ed1fd78f8e3be1d7f21dcc7.tar.xz
Part deactivated users in the background
One room at a time so we don't take out the whole server with leave
events, and restart at server restart.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/registration.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index a50717db2d..de068a55d2 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -526,3 +526,30 @@ class RegistrationStore(RegistrationWorkerStore,
         except self.database_engine.module.IntegrityError:
             ret = yield self.get_3pid_guest_access_token(medium, address)
             defer.returnValue(ret)
+
+    def add_user_pending_deactivation(self, user_id):
+        return self._simple_insert(
+            "users_pending_deactivation",
+            values={
+                "user_id": user_id,
+            },
+            desc="add_user_pending_deactivation",
+        )
+
+    def del_user_pending_deactivation(self, user_id):
+        return self._simple_delete_one(
+            "users_pending_deactivation",
+            keyvalues={
+                "user_id": user_id,
+            },
+            desc="del_user_pending_deactivation",
+        )
+
+    def get_user_pending_deactivation(self):
+        return self._simple_select_one_onecol(
+            "users_pending_deactivation",
+            keyvalues={},
+            retcol="user_id",
+            allow_none=True,
+            desc="get_users_pending_deactivation",
+        )