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/handlers/federation.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/handlers/federation.py')
-rw-r--r-- | synapse/handlers/federation.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 260df025f9..bab0db2904 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -639,7 +639,8 @@ class FederationHandler(BaseHandler): results = yield logcontext.make_deferred_yieldable(defer.gatherResults( [ - logcontext.preserve_fn(self.replication_layer.get_pdu)( + logcontext.run_in_background( + self.replication_layer.get_pdu, [dest], event_id, outlier=True, @@ -1025,7 +1026,7 @@ class FederationHandler(BaseHandler): # lots of requests for missing prev_events which we do actually # have. Hence we fire off the deferred, but don't wait for it. - logcontext.preserve_fn(self._handle_queued_pdus)(room_queue) + logcontext.run_in_background(self._handle_queued_pdus, room_queue) defer.returnValue(True) @@ -1527,8 +1528,9 @@ class FederationHandler(BaseHandler): if not backfilled: # this intentionally does not yield: we don't care about the result # and don't need to wait for it. - logcontext.preserve_fn(self.pusher_pool.on_new_notifications)( - event_stream_id, max_stream_id + logcontext.run_in_background( + self.pusher_pool.on_new_notifications, + event_stream_id, max_stream_id, ) defer.returnValue((context, event_stream_id, max_stream_id)) @@ -1542,7 +1544,8 @@ class FederationHandler(BaseHandler): """ contexts = yield logcontext.make_deferred_yieldable(defer.gatherResults( [ - logcontext.preserve_fn(self._prep_event)( + logcontext.run_in_background( + self._prep_event, origin, ev_info["event"], state=ev_info.get("state"), @@ -1871,7 +1874,8 @@ class FederationHandler(BaseHandler): different_events = yield logcontext.make_deferred_yieldable( defer.gatherResults([ - logcontext.preserve_fn(self.store.get_event)( + logcontext.run_in_background( + self.store.get_event, d, allow_none=True, allow_rejected=False, |