[cloud] Route53 Avoid throttling errors and unnecessary processing when checking rrsets. (#22104)

The boto Route53 get_all_rrsets method will return the record set
matching the name, type, and identifier specified, followed by ALL
subsequent sets in alphabetical order based on name. If the specified
set does not exist, the method will still return all the sets that
_would_ have come after it. Searching through sets we know will not
match is not just a waste of resources but, more importantly, often
triggers AWS API throttling when used on zones with large numbers of
records.
pull/25768/head
Robin Miller 8 years ago committed by Ryan Brown
parent fedbf3666b
commit 540e1bbd69

@ -561,7 +561,14 @@ def main():
record['values'] = sorted(rset.resource_records) record['values'] = sorted(rset.resource_records)
if command_in == 'create' and rset.to_xml() == wanted_rset.to_xml(): if command_in == 'create' and rset.to_xml() == wanted_rset.to_xml():
module.exit_json(changed=False) module.exit_json(changed=False)
break
# We need to look only at the first rrset returned by the above call,
# so break here. The returned elements begin with the one matching our
# requested name, type, and identifier, if such an element exists,
# followed by all others that come after it in alphabetical order.
# Therefore, if the first set does not match, no subsequent set will
# match either.
break
if command_in == 'get': if command_in == 'get':
if type_in == 'NS': if type_in == 'NS':

Loading…
Cancel
Save