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