diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-04-30 01:20:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 01:20:06 +0100 |
commit | 683149c1f98fec9bc39835083e608057af535b10 (patch) | |
tree | 0816263ed10369755f1aea7090cd39ee4dea56d7 /synapse/util/async.py | |
parent | Merge branch 'rav/test_36' into develop (diff) | |
parent | Merge branch 'develop' into py3-xrange-1 (diff) | |
download | synapse-683149c1f98fec9bc39835083e608057af535b10.tar.xz |
Merge pull request #3151 from NotAFile/py3-xrange-1
Move more xrange to six
Diffstat (limited to 'synapse/util/async.py')
-rw-r--r-- | synapse/util/async.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/util/async.py b/synapse/util/async.py index 4a762d1e72..9dd4e6b5bc 100644 --- a/synapse/util/async.py +++ b/synapse/util/async.py @@ -27,6 +27,8 @@ from contextlib import contextmanager import logging +from six.moves import range + logger = logging.getLogger(__name__) @@ -158,13 +160,13 @@ def concurrently_execute(func, args, limit): def _concurrently_execute_inner(): try: while True: - yield func(it.next()) + yield func(next(it)) except StopIteration: pass return logcontext.make_deferred_yieldable(defer.gatherResults([ run_in_background(_concurrently_execute_inner) - for _ in xrange(limit) + for _ in range(limit) ], consumeErrors=True)).addErrback(unwrapFirstError) |