lib/httpimagestore/s3_service.rb in httpimagestore-0.2.2 vs lib/httpimagestore/s3_service.rb in httpimagestore-0.2.3
- old
+ new
@@ -17,10 +17,14 @@
file = @bucket.objects.build(image_path)
file.content_type = content_type
file.content = data
- RetryThis.retry_this(:times => 3, :sleep => 0.1, :error_types => [Errno::ECONNRESET, S3::Error::RequestTimeout]) do |attempt|
+ RetryThis.retry_this(
+ :times => (@options[:upload_retry_times] or 1),
+ :sleep => (@options[:upload_retry_delay] or 0.0),
+ :error_types => [Errno::ECONNRESET, S3::Error::RequestTimeout]
+ ) do |attempt|
@logger.warn "Retrying S3 save operation" if attempt > 1
file.save
end
"http://#{@bucket.name}.s3.amazonaws.com/#{image_path}"