Skip to content

Commit

Permalink
remove unsupported chunked writes
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Nov 15, 2024
1 parent ed12c3f commit 4f2d1ac
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions app/workers/process_oci_image_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ def perform(artifact_id)
next if
client.head_object(bucket: descriptor.bucket, key: descriptor.key).successful? rescue false

# upload blob in chunks to reduce memory footprint
client.put_object(bucket: descriptor.bucket, key: descriptor.key, content_type: descriptor.content_type, content_length: descriptor.content_length) do |writer|
while chunk = blob.read(16 * 1024)
writer.write(chunk)
end
end
# TODO(ezekg) this should accept a block like get_object to support chunked writes
# see: https://github.com/aws/aws-sdk-ruby/issues/3142
client.put_object(
bucket: descriptor.bucket,
key: descriptor.key,
content_length: descriptor.content_length,
content_type: descriptor.content_type,
body: blob.to_io,
)
end
end
end
Expand Down

0 comments on commit 4f2d1ac

Please sign in to comment.