Skip to content

Commit

Permalink
Merge pull request #328 from dafyddcrosby/checksum_sandbox_put
Browse files Browse the repository at this point in the history
[SandboxesEndpoint#put] Move checksum discovery out of loop
  • Loading branch information
tpowell-progress authored Apr 30, 2024
2 parents cd7cf92 + cd094ef commit 95e39e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/chef_zero/endpoints/sandboxes_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ def post(request)

needed_checksums = FFI_Yajl::Parser.parse(request.body)["checksums"]
result_checksums = {}
available_checksums = list_data(request, request.rest_path[0..1] + %w{file_store checksums})
needed_checksums.keys.each do |needed_checksum|
if list_data(request, request.rest_path[0..1] + %w{file_store checksums}).include?(needed_checksum)
if available_checksums.include?(needed_checksum)
result_checksums[needed_checksum] = { needs_upload: false }
else
result_checksums[needed_checksum] = {
Expand Down

0 comments on commit 95e39e3

Please sign in to comment.