diff options
author | Erik Johnston <erik@matrix.org> | 2016-04-01 15:02:59 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-04-01 15:02:59 +0100 |
commit | a853cdec5beb74624e5ab4ec93bce7c37a67cf3e (patch) | |
tree | cf03ca30a3617e5c47e5d34eb7cd094dffdc1a48 /synapse/handlers/message.py | |
parent | Merge pull request #682 from matrix-org/markjh/fix_invalidate (diff) | |
parent | Comment (diff) | |
download | synapse-a853cdec5beb74624e5ab4ec93bce7c37a67cf3e.tar.xz |
Merge pull request #685 from matrix-org/erikj/sync_leave
Add concurrently_execute function
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 5c50c611ba..0bb111d047 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -21,6 +21,7 @@ from synapse.streams.config import PaginationConfig from synapse.events.utils import serialize_event from synapse.events.validator import EventValidator from synapse.util import unwrapFirstError +from synapse.util.async import concurrently_execute from synapse.util.caches.snapshot_cache import SnapshotCache from synapse.types import UserID, RoomStreamToken, StreamToken @@ -556,14 +557,7 @@ class MessageHandler(BaseHandler): except: logger.exception("Failed to get snapshot") - # Only do N rooms at once - n = 5 - d_list = [handle_room(e) for e in room_list] - for i in range(0, len(d_list), n): - yield defer.gatherResults( - d_list[i:i + n], - consumeErrors=True - ).addErrback(unwrapFirstError) + yield concurrently_execute(handle_room, room_list, 10) account_data_events = [] for account_data_type, content in account_data.items(): |