diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-04-30 01:02:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 01:02:25 +0100 |
commit | db75c86e8463b130d4dcd84e79c1ebee616f9689 (patch) | |
tree | b7c0c3e9262f8ca27470a0151cb5109472da20fa /synapse/storage | |
parent | Move more xrange to six (diff) | |
parent | Merge pull request #3085 from NotAFile/py3-config-text-mode (diff) | |
download | synapse-db75c86e8463b130d4dcd84e79c1ebee616f9689.tar.xz |
Merge branch 'develop' into py3-xrange-1
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/events_worker.py | 5 | ||||
-rw-r--r-- | synapse/storage/stream.py | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/synapse/storage/events_worker.py b/synapse/storage/events_worker.py index a937b9bceb..ba834854e1 100644 --- a/synapse/storage/events_worker.py +++ b/synapse/storage/events_worker.py @@ -20,7 +20,7 @@ from synapse.events import FrozenEvent from synapse.events.utils import prune_event from synapse.util.logcontext import ( - preserve_fn, PreserveLoggingContext, make_deferred_yieldable + PreserveLoggingContext, make_deferred_yieldable, run_in_background, ) from synapse.util.metrics import Measure from synapse.api.errors import SynapseError @@ -319,7 +319,8 @@ class EventsWorkerStore(SQLBaseStore): res = yield make_deferred_yieldable(defer.gatherResults( [ - preserve_fn(self._get_event_from_row)( + run_in_background( + self._get_event_from_row, row["internal_metadata"], row["json"], row["redacts"], rejected_reason=row["rejects"], ) diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py index 52c90d8e04..f0784ba137 100644 --- a/synapse/storage/stream.py +++ b/synapse/storage/stream.py @@ -41,7 +41,7 @@ from synapse.storage.events import EventsWorkerStore from synapse.util.caches.descriptors import cached from synapse.types import RoomStreamToken from synapse.util.caches.stream_change_cache import StreamChangeCache -from synapse.util.logcontext import make_deferred_yieldable, preserve_fn +from synapse.util.logcontext import make_deferred_yieldable, run_in_background from synapse.storage.engines import PostgresEngine, Sqlite3Engine import abc @@ -200,7 +200,8 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore): room_ids = list(room_ids) for rm_ids in (room_ids[i:i + 20] for i in range(0, len(room_ids), 20)): res = yield make_deferred_yieldable(defer.gatherResults([ - preserve_fn(self.get_room_events_stream_for_room)( + run_in_background( + self.get_room_events_stream_for_room, room_id, from_key, to_key, limit, order=order, ) for room_id in rm_ids |