Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
09a135b0
Commit
09a135b0
authored
5 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Make concurrently_execute work with async/await
parent
fec7d886
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/util/async_helpers.py
+3
-4
3 additions, 4 deletions
synapse/util/async_helpers.py
with
3 additions
and
4 deletions
synapse/util/async_helpers.py
+
3
−
4
View file @
09a135b0
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment