Skip to content
Snippets Groups Projects
Commit 09a135b0 authored by Erik Johnston's avatar Erik Johnston
Browse files

Make concurrently_execute work with async/await

parent fec7d886
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment