summary refs log tree commit diff
path: root/synapse/storage/registration.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-07-03 09:49:35 +0100
committerRichard van der Hoff <richard@matrix.org>2019-07-03 09:49:35 +0100
commit43e01be1584ea511541bbd259e978e161bf22f74 (patch)
tree0f369599513c1218645da8a385d4fdff0cdb8a1c /synapse/storage/registration.py
parentMerge branch 'release-v1.1.0' into matrix-org-hotfixes (diff)
parentFix a number of "Starting txn from sentinel context" warnings (#5605) (diff)
downloadsynapse-43e01be1584ea511541bbd259e978e161bf22f74.tar.xz
Merge remote-tracking branch 'origin/release-v1.1.0' into matrix-org-hotfixes
Diffstat (limited to 'synapse/storage/registration.py')
-rw-r--r--synapse/storage/registration.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py

index 983ce13291..13a3d5208b 100644 --- a/synapse/storage/registration.py +++ b/synapse/storage/registration.py
@@ -25,6 +25,7 @@ from twisted.internet import defer from synapse.api.constants import UserTypes from synapse.api.errors import Codes, StoreError, ThreepidValidationError +from synapse.metrics.background_process_metrics import run_as_background_process from synapse.storage import background_updates from synapse.storage._base import SQLBaseStore from synapse.types import UserID @@ -619,9 +620,15 @@ class RegistrationStore( ) # Create a background job for culling expired 3PID validity tokens - hs.get_clock().looping_call( - self.cull_expired_threepid_validation_tokens, THIRTY_MINUTES_IN_MS - ) + def start_cull(): + # run as a background process to make sure that the database transactions + # have a logcontext to report to + return run_as_background_process( + "cull_expired_threepid_validation_tokens", + self.cull_expired_threepid_validation_tokens, + ) + + hs.get_clock().looping_call(start_cull, THIRTY_MINUTES_IN_MS) @defer.inlineCallbacks def _backgroud_update_set_deactivated_flag(self, progress, batch_size):