[#2180] Avoid fetching old PJ modification times separately

Speeds up transfer
This commit is contained in:
Frederic Merizen 2018-12-08 15:55:40 +01:00
parent 7b18c51483
commit 270c7568fa
4 changed files with 25 additions and 19 deletions

View file

@ -91,7 +91,7 @@ module Cellar
if response.is_a?(Net::HTTPSuccess)
(listing, truncated) = parse_bucket_listing(response.body)
result += listing
marker = listing.last
marker = listing.last.first
else
# TODO: error handling
return nil
@ -139,8 +139,13 @@ module Cellar
def parse_bucket_listing(bucket_listing_xml)
doc = Nokogiri::XML(bucket_listing_xml)
listing = doc
.xpath('//xmlns:Contents/xmlns:Key')
.map(&:text)
.xpath('//xmlns:Contents')
.map do |node|
[
node.xpath('xmlns:Key').text,
DateTime.iso8601(node.xpath('xmlns:LastModified').text)
]
end
truncated = doc.xpath('//xmlns:IsTruncated').text == 'true'
[listing, truncated]
end