summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-04-27 11:46:00 +0100
committerDavid Baker <dave@matrix.org>2015-04-27 11:46:00 +0100
commitb02e1006b9d7282cdc9983d52ac478d4670a8361 (patch)
tree4ed96724bd80785ddb02af7ea66c0e953394a939 /synapse/storage
parentrename db method to be more informative (diff)
downloadsynapse-b02e1006b9d7282cdc9983d52ac478d4670a8361.tar.xz
Run database check before daemonizing, at the cost of database hygiene.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/__init__.py10
-rw-r--r--synapse/storage/registration.py18
2 files changed, 10 insertions, 18 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index f4dec70393..0c47443689 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -421,3 +421,13 @@ def prepare_sqlite3_database(db_conn):
                     " VALUES (?,?)",
                     (row[0], False)
                 )
+
+
+def are_all_users_on_domain(txn, domain):
+    sql = "SELECT COUNT(*) FROM users WHERE name NOT LIKE ?"
+    pat = "%:" + domain
+    cursor = txn.execute(sql, (pat,))
+    num_not_matching = cursor.fetchall()[0][0]
+    if num_not_matching == 0:
+        return True
+    return False
\ No newline at end of file
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 65ae58a39c..f24154f146 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -144,21 +144,3 @@ class RegistrationStore(SQLBaseStore):
             return rows[0]
 
         raise StoreError(404, "Token not found.")
-
-    @defer.inlineCallbacks
-    def are_all_users_on_domain(self, domain):
-        res = yield self.runInteraction(
-            "are_all_users_on_domain",
-            self._are_all_users_on_domain_txn,
-            domain
-        )
-        defer.returnValue(res)
-
-    def _are_all_users_on_domain_txn(self, txn, domain):
-        sql = "SELECT COUNT(*) FROM users WHERE name NOT LIKE ?"
-        pat = "%:" + domain
-        cursor = txn.execute(sql, (pat,))
-        num_not_matching = cursor.fetchall()[0][0]
-        if num_not_matching == 0:
-            return True
-        return False