summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-05-30 14:28:26 +0100
committerGitHub <noreply@github.com>2019-05-30 14:28:26 +0100
commite9e5d3392df564a67dcdc222dc77109a2b807ddd (patch)
tree1dbc302becbeda767f4c65f3aa6d33397e8eadb5 /synapse/storage/_base.py
parentMerge pull request #5256 from aaronraimist/logout-correct-error (diff)
parentUpdate synapse/storage/events_bg_updates.py (diff)
downloadsynapse-e9e5d3392df564a67dcdc222dc77109a2b807ddd.tar.xz
Merge pull request #5278 from matrix-org/erikj/cleanup_bad_extremities
 Add DB bg update to cleanup extremities.
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index fa6839ceca..3fe827cd43 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -1261,7 +1261,8 @@ class SQLBaseStore(object):
             " AND ".join("%s = ?" % (k,) for k in keyvalues),
         )
 
-        return txn.execute(sql, list(keyvalues.values()))
+        txn.execute(sql, list(keyvalues.values()))
+        return txn.rowcount
 
     def _simple_delete_many(self, table, column, iterable, keyvalues, desc):
         return self.runInteraction(
@@ -1280,9 +1281,12 @@ class SQLBaseStore(object):
             column : column name to test for inclusion against `iterable`
             iterable : list
             keyvalues : dict of column names and values to select the rows with
+
+        Returns:
+            int: Number rows deleted
         """
         if not iterable:
-            return
+            return 0
 
         sql = "DELETE FROM %s" % table
 
@@ -1297,7 +1301,9 @@ class SQLBaseStore(object):
 
         if clauses:
             sql = "%s WHERE %s" % (sql, " AND ".join(clauses))
-        return txn.execute(sql, values)
+        txn.execute(sql, values)
+
+        return txn.rowcount
 
     def _get_cache_dict(
         self, db_conn, table, entity_column, stream_column, max_value, limit=100000