lib/astrails/safe/s3.rb in astrails-safe-0.2.0 vs lib/astrails/safe/s3.rb in astrails-safe-0.2.1
- old
+ new
@@ -18,14 +18,17 @@
# needed in cleanup even on dry run
AWS::S3::Base.establish_connection!(:access_key_id => key, :secret_access_key => secret, :use_ssl => true) unless $LOCAL
puts "Uploading #{bucket}:#{full_path}" if $_VERBOSE || $DRY_RUN
unless $DRY_RUN || $LOCAL
- AWS::S3::Bucket.create(bucket)
- File.open(@backup.path) do |file|
- AWS::S3::S3Object.store(full_path, file, bucket)
+ benchmark = Benchmark.realtime do
+ AWS::S3::Bucket.create(bucket)
+ File.open(@backup.path) do |file|
+ AWS::S3::S3Object.store(full_path, file, bucket)
+ end
end
puts "...done" if $_VERBOSE
+ puts("Upload took " + sprintf("%.2f", benchmark) + " second(s).") if $_VERBOSE
end
end
def cleanup
return if $LOCAL