diff options
author | David Baker <dave@matrix.org> | 2016-05-20 17:56:10 +0100 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2016-05-20 17:56:10 +0100 |
commit | d4503e25ed01b6053bd5bb503f858a2ab934e350 (patch) | |
tree | 41889b6c26c4c155b7cf28a6f0a087c90891acba /synapse/storage/__init__.py | |
parent | Only delete push actions after 30 days (diff) | |
download | synapse-d4503e25ed01b6053bd5bb503f858a2ab934e350.tar.xz |
Make deleting push actions more efficient
There's no index on received_ts, so manually binary search using the stream_ordering index, and only update it once an hour.
Diffstat (limited to 'synapse/storage/__init__.py')
-rw-r--r-- | synapse/storage/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py index d970fde9e8..49feb77779 100644 --- a/synapse/storage/__init__.py +++ b/synapse/storage/__init__.py @@ -88,6 +88,7 @@ class DataStore(RoomMemberStore, RoomStore, def __init__(self, db_conn, hs): self.hs = hs + self._clock = hs.get_clock() self.database_engine = hs.database_engine self.client_ip_last_seen = Cache( @@ -173,6 +174,14 @@ class DataStore(RoomMemberStore, RoomStore, prefilled_cache=push_rules_prefill, ) + cur = db_conn.cursor() + self._find_stream_orderings_for_times_txn(cur) + cur.close() + + self.find_stream_orderings_looping_call = self._clock.looping_call( + self._find_stream_orderings_for_times, 60 * 60 * 1000 + ) + super(DataStore, self).__init__(hs) def take_presence_startup_info(self): |