mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-18 09:44:49 +01:00
Log actual number of entries deleted
This commit is contained in:
parent
6ebc08c09d
commit
1d818fde14
2 changed files with 13 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -2476,7 +2476,7 @@ class EventsStore(
|
|||
|
||||
logger.info("Deleting up to %d forward extremities", len(to_delete))
|
||||
|
||||
self._simple_delete_many_txn(
|
||||
deleted = self._simple_delete_many_txn(
|
||||
txn=txn,
|
||||
table="event_forward_extremities",
|
||||
column="event_id",
|
||||
|
@ -2484,7 +2484,9 @@ class EventsStore(
|
|||
keyvalues={},
|
||||
)
|
||||
|
||||
if to_delete:
|
||||
logger.info("Deleted %d forward extremities", deleted)
|
||||
|
||||
if deleted:
|
||||
# We now need to invalidate the caches of these rooms
|
||||
rows = self._simple_select_many_txn(
|
||||
txn,
|
||||
|
|
Loading…
Reference in a new issue