Skip to content

Commit

Permalink
(#950) Many minor fixes in incrementally_list_bucket to prevent a dea…
Browse files Browse the repository at this point in the history
…th loop in

certain rare conditions


git-svn-id: https://wush.net/svn/rightscale/right_aws/trunk@2963 9f0cbaf6-ce18-0410-ad37-d14a22affa91
  • Loading branch information
trbryan committed Mar 7, 2008
1 parent 5336155 commit 6b61574
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/right_aws.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module RightAws #:nodoc:
module VERSION #:nodoc:
MAJOR = 1
MINOR = 6
TINY = 0
TINY = 1

STRING = [MAJOR, MINOR, TINY].join('.')
end
Expand Down
15 changes: 11 additions & 4 deletions lib/s3/right_s3_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,21 @@ def incrementally_list_bucket(bucket, options={}, headers={}, &block)
there_are_more_keys = response[:is_truncated]
if(there_are_more_keys)
if(response[:next_marker])
internal_options[:marker] = response[:next_marker]
# Dup from response so that no one can mess with these values in the
# yield block
internal_options[:marker] = response[:next_marker].dup
else
internal_options[:marker] = response[:contents].last[:key]
if( response[:contents].last[:key] > response[:common_prefixes].last )
internal_options[:marker] = response[:contents].last[:key].dup
else
internal_options[:marker] = response[:common_prefixes].last.dup
end
end
internal_options[:'max-keys'] ? (internal_options[:'max-keys'] -= response[:contents].length) : nil
total_results = response[:contents].length + response[:common_prefixes].length
internal_options[:'max-keys'] ? (internal_options[:'max-keys'] -= total_results) : nil
end
yield response
end while there_are_more_keys
end while there_are_more_keys && internal_options[:'max-keys'] > 0
true
rescue
on_exception
Expand Down

0 comments on commit 6b61574

Please sign in to comment.