summary refs log tree commit diff
path: root/synapse/util/async_helpers.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-10-30 11:43:51 +0100
committerGitHub <noreply@github.com>2019-10-30 11:43:51 +0100
commitb4465564cc89c154cf665b9de39a2f38f87ef41c (patch)
treebbe0967729ea48a5d962b157c6e762c83295b054 /synapse/util/async_helpers.py
parentFix CI for synapse_port_db (#6276) (diff)
parentDon't return coroutines (diff)
downloadsynapse-b4465564cc89c154cf665b9de39a2f38f87ef41c.tar.xz
Merge pull request #6279 from matrix-org/erikj/federation_server_async_await
Port federation_server to async/await
Diffstat (limited to 'synapse/util/async_helpers.py')
-rw-r--r--synapse/util/async_helpers.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/synapse/util/async_helpers.py b/synapse/util/async_helpers.py

index 804dbca443..7659eaeb42 100644 --- a/synapse/util/async_helpers.py +++ b/synapse/util/async_helpers.py
@@ -138,7 +138,7 @@ def concurrently_execute(func, args, limit): the number of concurrent executions. Args: - func (func): Function to execute, should return a deferred. + func (func): Function to execute, should return a deferred or coroutine. args (list): List of arguments to pass to func, each invocation of func gets a signle argument. limit (int): Maximum number of conccurent executions. @@ -148,11 +148,10 @@ def concurrently_execute(func, args, limit): """ it = iter(args) - @defer.inlineCallbacks - def _concurrently_execute_inner(): + async def _concurrently_execute_inner(): try: while True: - yield func(next(it)) + await maybe_awaitable(func(next(it))) except StopIteration: pass