diff options
author | Erik Johnston <erik@matrix.org> | 2015-06-25 14:11:18 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-06-25 14:11:18 +0100 |
commit | 3cf2203c5cccf161f099104bc0d6028eec2ec442 (patch) | |
tree | 3ad7bbffd6d8d4d5879db9ac8211a449f9eb8186 | |
parent | Add unwrapFirstError (diff) | |
download | synapse-3cf2203c5cccf161f099104bc0d6028eec2ec442.tar.xz |
Don't parallelise persist_events
-rw-r--r-- | synapse/storage/events.py | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 9341793a61..064490ae18 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -76,31 +76,16 @@ class EventsStore(SQLBaseStore): for x in xrange(0, len(events_and_contexts), 100) ] - if is_new_state: - # If is_new_state then we have to do chunks in order - for chunk in chunks: - yield self.runInteraction( - "persist_events", - self._persist_events_txn, - events_and_contexts=chunk, - backfilled=backfilled, - is_new_state=is_new_state, - ) - else: - # Otherwise, do them sequentially - yield defer.gatherResults( - [ - self.runInteraction( - "persist_events", - self._persist_events_txn, - events_and_contexts=chunk, - backfilled=backfilled, - is_new_state=is_new_state, - ) - for chunk in chunks - ], - consumeErrors=True, - ).addErrback(unwrapFirstError) + for chunk in chunks: + # We can't easily parallelize these since different chunks + # might contain the same event. :() + yield self.runInteraction( + "persist_events", + self._persist_events_txn, + events_and_contexts=chunk, + backfilled=backfilled, + is_new_state=is_new_state, + ) @defer.inlineCallbacks @log_function |