summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-10-01 13:23:34 +0100
committerErik Johnston <erik@matrix.org>2019-10-01 13:43:48 +0100
commit898dde981b41a4dfb79b5830f17e6eb9871ef762 (patch)
tree517c9049abed48198b6f72fe61663c42c7ca0ca3 /synapse/storage/events.py
parentDon't repeatedly attempt to censor events we don't have. (diff)
downloadsynapse-898dde981b41a4dfb79b5830f17e6eb9871ef762.tar.xz
Add received_ts column to redactions.
This will allow us to efficiently search for uncensored redactions in
the DB before a given time.
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py

index 5d56ceeab3..3104815f1a 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py
@@ -1397,12 +1397,8 @@ class EventsStore( self._simple_update_txn( txn, table="redactions", - keyvalues={ - "redacts": event.event_id, - }, - updatevalues={ - "have_censored": False, - } + keyvalues={"redacts": event.event_id}, + updatevalues={"have_censored": False}, ) def _store_rejected_events_txn(self, txn, events_and_contexts): @@ -1568,9 +1564,15 @@ class EventsStore( def _store_redaction(self, txn, event): # invalidate the cache for the redacted event txn.call_after(self._invalidate_get_event_cache, event.redacts) - txn.execute( - "INSERT INTO redactions (event_id, redacts) VALUES (?,?)", - (event.event_id, event.redacts), + + self._simple_insert_txn( + txn, + table="redactions", + values={ + "event_id": event.event_id, + "redacts": event.redacts, + "received_ts": self._clock.time_msec(), + }, ) @defer.inlineCallbacks