Skip to content

Instantly share code, notes, and snippets.

@pmarreck
Created June 5, 2012 21:15
Show Gist options
  • Save pmarreck/2878009 to your computer and use it in GitHub Desktop.
Save pmarreck/2878009 to your computer and use it in GitHub Desktop.
AWS programmers whut?
# This is inside a "def write" method in the AWS::S3 gem. There is no error check code whatsoever. On a write, over the wire, to an external resource.
# Amazon can't acknowledge that its stuff goes down sometimes or errors out, apparently... :)
if use_multipart?(data_options, put_options)
put_options.delete(:multipart_threshold)
multipart_upload(put_options) do |upload|
each_part(data_options, put_options) do |part|
upload.add_part(part)
end
end
else
opts = { :bucket_name => bucket.name, :key => key }
resp = client.put_object(opts.merge(put_options).merge(data_options))
if resp.version_id # Shouldn't this be resp.respond_to? :version_id ?
ObjectVersion.new(self, resp.version_id)
else
self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment