Skip to content

Commit

Permalink
[Bug]Concurrent upload (Azure#11668)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiafu-msft authored Jun 6, 2020
1 parent c35c3a5 commit 0245fce
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def _parallel_uploads(executor, uploader, pending, running):
done, running = futures.wait(running, return_when=futures.FIRST_COMPLETED)
range_ids.extend([chunk.result() for chunk in done])
try:
next_chunk = next(pending)
for _ in range(0, len(done)):
next_chunk = next(pending)
running.add(executor.submit(with_current_context(uploader), next_chunk))
except StopIteration:
break
else:
running.add(executor.submit(with_current_context(uploader), next_chunk))

# Wait for the remaining uploads to finish
done, _running = futures.wait(running)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ async def _parallel_uploads(uploader, pending, running):
done, running = await asyncio.wait(running, return_when=asyncio.FIRST_COMPLETED)
range_ids.extend([chunk.result() for chunk in done])
try:
next_chunk = next(pending)
for _ in range(0, len(done)):
next_chunk = next(pending)
running.add(asyncio.ensure_future(uploader(next_chunk)))
except StopIteration:
break
else:
running.add(asyncio.ensure_future(uploader(next_chunk)))

# Wait for the remaining uploads to finish
if running:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def _parallel_uploads(executor, uploader, pending, running):
done, running = futures.wait(running, return_when=futures.FIRST_COMPLETED)
range_ids.extend([chunk.result() for chunk in done])
try:
next_chunk = next(pending)
for _ in range(0, len(done)):
next_chunk = next(pending)
running.add(executor.submit(with_current_context(uploader), next_chunk))
except StopIteration:
break
else:
running.add(executor.submit(with_current_context(uploader), next_chunk))

# Wait for the remaining uploads to finish
done, _running = futures.wait(running)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ async def _parallel_uploads(uploader, pending, running):
done, running = await asyncio.wait(running, return_when=asyncio.FIRST_COMPLETED)
range_ids.extend([chunk.result() for chunk in done])
try:
next_chunk = next(pending)
for _ in range(0, len(done)):
next_chunk = next(pending)
running.add(asyncio.ensure_future(uploader(next_chunk)))
except StopIteration:
break
else:
running.add(asyncio.ensure_future(uploader(next_chunk)))

# Wait for the remaining uploads to finish
if running:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def _parallel_uploads(executor, uploader, pending, running):
done, running = futures.wait(running, return_when=futures.FIRST_COMPLETED)
range_ids.extend([chunk.result() for chunk in done])
try:
next_chunk = next(pending)
for _ in range(0, len(done)):
next_chunk = next(pending)
running.add(executor.submit(with_current_context(uploader), next_chunk))
except StopIteration:
break
else:
running.add(executor.submit(with_current_context(uploader), next_chunk))

# Wait for the remaining uploads to finish
done, _running = futures.wait(running)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ async def _parallel_uploads(uploader, pending, running):
done, running = await asyncio.wait(running, return_when=asyncio.FIRST_COMPLETED)
range_ids.extend([chunk.result() for chunk in done])
try:
next_chunk = next(pending)
for _ in range(0, len(done)):
next_chunk = next(pending)
running.add(asyncio.ensure_future(uploader(next_chunk)))
except StopIteration:
break
else:
running.add(asyncio.ensure_future(uploader(next_chunk)))

# Wait for the remaining uploads to finish
if running:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def _parallel_uploads(executor, uploader, pending, running):
done, running = futures.wait(running, return_when=futures.FIRST_COMPLETED)
range_ids.extend([chunk.result() for chunk in done])
try:
next_chunk = next(pending)
for _ in range(0, len(done)):
next_chunk = next(pending)
running.add(executor.submit(with_current_context(uploader), next_chunk))
except StopIteration:
break
else:
running.add(executor.submit(with_current_context(uploader), next_chunk))

# Wait for the remaining uploads to finish
done, _running = futures.wait(running)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ async def _parallel_uploads(uploader, pending, running):
done, running = await asyncio.wait(running, return_when=asyncio.FIRST_COMPLETED)
range_ids.extend([chunk.result() for chunk in done])
try:
next_chunk = next(pending)
for _ in range(0, len(done)):
next_chunk = next(pending)
running.add(asyncio.ensure_future(uploader(next_chunk)))
except StopIteration:
break
else:
running.add(asyncio.ensure_future(uploader(next_chunk)))

# Wait for the remaining uploads to finish
if running:
Expand Down

0 comments on commit 0245fce

Please sign in to comment.