summary refs log tree commit diff
path: root/synapse/storage/client_ips.py
diff options
context:
space:
mode:
authorWill Hunt <will@half-shot.uk>2018-07-27 12:26:52 +0100
committerWill Hunt <will@half-shot.uk>2018-07-27 12:26:52 +0100
commit46afacc215db24b128e502c2c23cc3f3205d6f70 (patch)
treeeb8bd164bcc1b49b507e4d41c900325bcbfc5a5a /synapse/storage/client_ips.py
parentAuth media/r0/config (diff)
parentMerge pull request #3391 from t3chguy/t3chguy/default_inviter_display_name_3pid (diff)
downloadsynapse-46afacc215db24b128e502c2c23cc3f3205d6f70.tar.xz
Merge remote-tracking branch 'upstream/develop' into hs/upload-limits
Diffstat (limited to 'synapse/storage/client_ips.py')
-rw-r--r--synapse/storage/client_ips.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/synapse/storage/client_ips.py b/synapse/storage/client_ips.py

index b78eda3413..b8cefd43d6 100644 --- a/synapse/storage/client_ips.py +++ b/synapse/storage/client_ips.py
@@ -19,6 +19,7 @@ from six import iteritems from twisted.internet import defer +from synapse.metrics.background_process_metrics import run_as_background_process from synapse.util.caches import CACHE_SIZE_FACTOR from . import background_updates @@ -93,10 +94,16 @@ class ClientIpStore(background_updates.BackgroundUpdateStore): self._batch_row_update[key] = (user_agent, device_id, now) def _update_client_ips_batch(self): - to_update = self._batch_row_update - self._batch_row_update = {} - return self.runInteraction( - "_update_client_ips_batch", self._update_client_ips_batch_txn, to_update + def update(): + to_update = self._batch_row_update + self._batch_row_update = {} + return self.runInteraction( + "_update_client_ips_batch", self._update_client_ips_batch_txn, + to_update, + ) + + return run_as_background_process( + "update_client_ips", update, ) def _update_client_ips_batch_txn(self, txn, to_update):