@@ -46,33 +46,34 @@ def perform
4646 puts ( "downloaded #{ Buildpack . count } buildpacks, total #{ bytes_read } bytes read" )
4747 log_timing ( 'buildpack download timing' , timing )
4848
49- droplet_guid , timing = upload_droplet ( zip_file )
50- log_timing ( 'droplet upload timing' , timing )
51- log_timing ( 'droplet download timing' , download_droplet ( droplet_guid , resource_dir ) )
49+ droplet_results = [ ]
5250
5351 SIZES . each do |label , bytes |
5452 Tempfile . create ( [ "big-droplet-#{ label } " , '.bin' ] , resource_dir ) do |tempfile |
5553 write_file_of_size ( tempfile . path , bytes )
5654
5755 guid , upload_timing = upload_droplet ( tempfile . path )
5856 big_droplet_guids << guid
59- log_timing ( "big droplet #{ label } upload timing" , upload_timing )
60- log_timing ( "big droplet #{ label } download timing" , download_droplet ( guid , resource_dir ) )
57+ droplet_results << { label : "droplet #{ label } " , guid : guid , upload_timing : upload_timing }
6158 end
6259 end
60+
61+ droplet_results . each do |r |
62+ log_timing ( "#{ r [ :label ] } upload timing" , r [ :upload_timing ] )
63+ log_timing ( "#{ r [ :label ] } download timing" , download_droplet ( r [ :guid ] , resource_dir ) )
64+ end
6365 ensure
6466 FileUtils . remove_dir ( resource_dir , true ) if resource_dir
6567 FileUtils . remove_dir ( zip_output_dir , true ) if zip_output_dir
6668
6769 safe_delete ( package_blobstore_client , package_guid )
68- safe_delete ( droplet_blobstore_client , droplet_guid )
6970 Array ( big_droplet_guids ) . each { |g | safe_delete ( droplet_blobstore_client , g ) }
7071 end
7172
7273 def resource_match ( dir_path )
73- resources = Find . find ( dir_path )
74- . select { |f | File . file? ( f ) }
75- . map { |f | { 'size' => File . stat ( f ) . size , 'sha1' => Digester . new . digest_path ( f ) } }
74+ resources = Find . find ( dir_path ) .
75+ select { |f | File . file? ( f ) } .
76+ map { |f | { 'size' => File . stat ( f ) . size , 'sha1' => Digester . new . digest_path ( f ) } }
7677
7778 ::Benchmark . realtime do
7879 resource_pool . match_resources ( resources )
@@ -155,9 +156,9 @@ def generate_resources
155156 def zip_resources ( resource_dir , output_dir )
156157 zip_file = File . join ( output_dir , 'zipped_package' )
157158 Zip ::File . open ( zip_file , create : true ) do |zipfile |
158- Find . find ( resource_dir )
159- . select { |f | File . file? ( f ) }
160- . each { |file | zipfile . add ( File . basename ( file ) , file ) }
159+ Find . find ( resource_dir ) .
160+ select { |f | File . file? ( f ) } .
161+ each { |file | zipfile . add ( File . basename ( file ) , file ) }
161162 end
162163 zip_file
163164 end
0 commit comments