diff options
author | Matthew Hodgson <matthew@matrix.org> | 2018-07-25 17:27:49 +0100 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2018-07-25 17:27:49 +0100 |
commit | 2565804030b14eab5f1455e8a860c1fbd71d45fc (patch) | |
tree | 7cdac37c0d7a0611b54f32312fdf5028c0c91b44 /synapse/storage/transactions.py | |
parent | flake8 (diff) | |
parent | Merge pull request #3603 from matrix-org/erikj/handle_outliers (diff) | |
download | synapse-2565804030b14eab5f1455e8a860c1fbd71d45fc.tar.xz |
Merge branch 'develop' into matthew/filter_members
Diffstat (limited to 'synapse/storage/transactions.py')
-rw-r--r-- | synapse/storage/transactions.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/storage/transactions.py b/synapse/storage/transactions.py index c3bc94f56d..b4b479d94c 100644 --- a/synapse/storage/transactions.py +++ b/synapse/storage/transactions.py @@ -22,6 +22,7 @@ from canonicaljson import encode_canonical_json, json from twisted.internet import defer +from synapse.metrics.background_process_metrics import run_as_background_process from synapse.util.caches.descriptors import cached from ._base import SQLBaseStore @@ -57,7 +58,7 @@ class TransactionStore(SQLBaseStore): def __init__(self, db_conn, hs): super(TransactionStore, self).__init__(db_conn, hs) - self._clock.looping_call(self._cleanup_transactions, 30 * 60 * 1000) + self._clock.looping_call(self._start_cleanup_transactions, 30 * 60 * 1000) def get_received_txn_response(self, transaction_id, origin): """For an incoming transaction from a given origin, check if we have @@ -271,6 +272,9 @@ class TransactionStore(SQLBaseStore): txn.execute(query, (self._clock.time_msec(),)) return self.cursor_to_dict(txn) + def _start_cleanup_transactions(self): + run_as_background_process("cleanup_transactions", self._cleanup_transactions) + def _cleanup_transactions(self): now = self._clock.time_msec() month_ago = now - 30 * 24 * 60 * 60 * 1000 |