mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
server: switch Amazon AWS S3 upload to streaming mode
This keeps memory usage low because it only has to read a chunk at a time into memory while before it read the whole file into memory before uploading it. This also seems to handle setting the permissions ACL better.
This commit is contained in:
parent
b5cbb4382f
commit
3af38569a2
1 changed files with 5 additions and 5 deletions
|
|
@ -104,11 +104,11 @@ def update_awsbucket(repo_section):
|
||||||
extra['content_type'] = 'application/pgp-signature'
|
extra['content_type'] = 'application/pgp-signature'
|
||||||
logging.info(' uploading ' + os.path.relpath(file_to_upload)
|
logging.info(' uploading ' + os.path.relpath(file_to_upload)
|
||||||
+ ' to s3://' + awsbucket + '/' + object_name)
|
+ ' to s3://' + awsbucket + '/' + object_name)
|
||||||
obj = driver.upload_object(file_path=file_to_upload,
|
with open(file_to_upload, 'rb') as iterator:
|
||||||
container=container,
|
obj = driver.upload_object_via_stream(iterator=iterator,
|
||||||
object_name=object_name,
|
container=container,
|
||||||
verify_hash=False,
|
object_name=object_name,
|
||||||
extra=extra)
|
extra=extra)
|
||||||
# delete the remnants in the bucket, they do not exist locally
|
# delete the remnants in the bucket, they do not exist locally
|
||||||
while objs:
|
while objs:
|
||||||
object_name, obj = objs.popitem()
|
object_name, obj = objs.popitem()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue