diff options
author | Matthew Hodgson <matthew@matrix.org> | 2017-11-30 01:51:38 +0000 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2017-11-30 01:51:38 +0000 |
commit | f397153dfc4020744e1cf8687abb01d4b7885a7a (patch) | |
tree | 342da238d1e7de6178731ad6a040bf9c3de16ce1 /synapse/federation/transaction_queue.py | |
parent | specify default user_directory_include_pattern (diff) | |
parent | Merge pull request #2721 from matrix-org/rav/get_user_by_access_token_comments (diff) | |
download | synapse-f397153dfc4020744e1cf8687abb01d4b7885a7a.tar.xz |
Merge branch 'develop' into matthew/search-all-local-users
Diffstat (limited to 'synapse/federation/transaction_queue.py')
-rw-r--r-- | synapse/federation/transaction_queue.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py index 7a3c9cbb70..3e7809b04f 100644 --- a/synapse/federation/transaction_queue.py +++ b/synapse/federation/transaction_queue.py @@ -20,7 +20,7 @@ from .persistence import TransactionActions from .units import Transaction, Edu from synapse.api.errors import HttpResponseException -from synapse.util import logcontext +from synapse.util import logcontext, PreserveLoggingContext from synapse.util.async import run_on_reactor from synapse.util.retryutils import NotRetryingDestination, get_retry_limiter from synapse.util.metrics import measure_func @@ -146,7 +146,6 @@ class TransactionQueue(object): else: return not destination.startswith("localhost") - @defer.inlineCallbacks def notify_new_events(self, current_id): """This gets called when we have some new events we might want to send out to other servers. @@ -156,6 +155,13 @@ class TransactionQueue(object): if self._is_processing: return + # fire off a processing loop in the background. It's likely it will + # outlast the current request, so run it in the sentinel logcontext. + with PreserveLoggingContext(): + self._process_event_queue_loop() + + @defer.inlineCallbacks + def _process_event_queue_loop(self): try: self._is_processing = True while True: |