diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-04-30 00:34:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 00:34:28 +0100 |
commit | aab2e4da60a11de3d84e9a603077cc43386db1f4 (patch) | |
tree | f3b6b59408b7ca4cd16925ff7f1f50785032872b /synapse/appservice/scheduler.py | |
parent | Merge pull request #3156 from NotAFile/py3-hmac-bytes (diff) | |
parent | pep8; remove spurious import (diff) | |
download | synapse-aab2e4da60a11de3d84e9a603077cc43386db1f4.tar.xz |
Merge pull request #3140 from matrix-org/rav/use_run_in_background
Use run_in_background in preference to preserve_fn
Diffstat (limited to 'synapse/appservice/scheduler.py')
-rw-r--r-- | synapse/appservice/scheduler.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/synapse/appservice/scheduler.py b/synapse/appservice/scheduler.py index dfc8d1b42e..6eddbc0828 100644 --- a/synapse/appservice/scheduler.py +++ b/synapse/appservice/scheduler.py @@ -51,7 +51,7 @@ components. from twisted.internet import defer from synapse.appservice import ApplicationServiceState -from synapse.util.logcontext import preserve_fn +from synapse.util.logcontext import run_in_background from synapse.util.metrics import Measure import logging @@ -106,7 +106,7 @@ class _ServiceQueuer(object): def enqueue(self, service, event): # if this service isn't being sent something self.queued_events.setdefault(service.id, []).append(event) - preserve_fn(self._send_request)(service) + run_in_background(self._send_request, service) @defer.inlineCallbacks def _send_request(self, service): @@ -152,10 +152,10 @@ class _TransactionController(object): if sent: yield txn.complete(self.store) else: - preserve_fn(self._start_recoverer)(service) - except Exception as e: - logger.exception(e) - preserve_fn(self._start_recoverer)(service) + run_in_background(self._start_recoverer, service) + except Exception: + logger.exception("Error creating appservice transaction") + run_in_background(self._start_recoverer, service) @defer.inlineCallbacks def on_recovered(self, recoverer): |