Skip to content

Commit

Permalink
Added request concurrency limits in S3.copy
Browse files Browse the repository at this point in the history
  • Loading branch information
terricain committed Oct 13, 2024
1 parent f61eb2e commit 0b83780
Show file tree
Hide file tree
Showing 3 changed files with 1,267 additions and 997 deletions.
6 changes: 5 additions & 1 deletion aioboto3/s3/inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,10 +621,14 @@ async def copy(
finished_parts = []
total_size = 0

sem = asyncio.Semaphore(Config.max_request_concurrency)

async def uploader(size: int, part_args: Dict[str, Any]):
nonlocal total_size

upload_part_response = await self.upload_part_copy(**part_args)
async with sem:
upload_part_response = await self.upload_part_copy(**part_args)

finished_parts.append({'ETag': upload_part_response['CopyPartResult']['ETag'], 'PartNumber': part_args['PartNumber']})

# Call the callback, if it blocks then not good :/
Expand Down
Loading

0 comments on commit 0b83780

Please sign in to comment.