diff options
author | Adrian Tschira <nota@notafile.com> | 2018-04-28 13:57:00 +0200 |
---|---|---|
committer | Adrian Tschira <nota@notafile.com> | 2018-04-28 13:57:00 +0200 |
commit | d82b6ea9e68150aece1fc46cb0821b31cf728910 (patch) | |
tree | b4a57fab25332b4be822ede7b38a67868caa28d3 /synapse/util/async.py | |
parent | Merge pull request #3127 from matrix-org/rav/deferred_timeout (diff) | |
download | synapse-d82b6ea9e68150aece1fc46cb0821b31cf728910.tar.xz |
Move more xrange to six
plus a bonus next() Signed-off-by: Adrian Tschira <nota@notafile.com>
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 1df5c5600c..cb53c31123 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([ preserve_fn(_concurrently_execute_inner)() - for _ in xrange(limit) + for _ in range(limit) ], consumeErrors=True)).addErrback(unwrapFirstError) |