This commit is contained in:
xds
2026-02-12 15:50:43 +03:00
parent 9d2e4e47de
commit dcab238d3e
5 changed files with 6 additions and 6 deletions

View File

@@ -61,12 +61,12 @@ class S3Adapter:
try:
async with self._get_client() as client:
response = await client.get_object(Bucket=self.bucket_name, Key=object_name)
async with response['Body'] as stream:
while True:
chunk = await stream.read(chunk_size)
if not chunk:
break
yield chunk
# aioboto3 Body is an aiohttp StreamReader wrapper
body = response['Body']
data = await body.read()
# Yield in chunks to avoid holding entire response in StreamingResponse buffer
for i in range(0, len(data), chunk_size):
yield data[i:i + chunk_size]
except ClientError as e:
print(f"Error streaming from S3: {e}")
return