Skip to content

Commit

Permalink
Added options to batch_put_attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Reeder committed Dec 22, 2010
1 parent 6912c10 commit 673c5a1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/sdb/right_sdb_interface.rb
Expand Up @@ -389,7 +389,7 @@ def create_domain_if_not_exist(ex, domain_name)

#
# items is an array of Aws::SdbInterface::Item.new(o.id, o.attributes, true)
def batch_put_attributes(domain_name, items)
def batch_put_attributes(domain_name, items, options={})
params = {'DomainName' => domain_name}
i = 0
items.each do |item|
Expand All @@ -399,7 +399,17 @@ def batch_put_attributes(domain_name, items)
i += 1
end
link = generate_request("BatchPutAttributes", params)
request_info(link, QSdbSimpleParser.new)
begin
request_info(link, QSdbSimpleParser.new, options)
rescue Aws::AwsError => ex
# puts "RESCUED in batch_put_attributes: " + $!
if options[:create_domain] && create_domain_if_not_exist(ex, domain_name)
options.delete(:create_domain)
batch_put_attributes(domain_name, items, options)
else
raise ex
end
end
rescue Exception
on_exception
end
Expand Down

0 comments on commit 673c5a1

Please sign in to comment.