Merge pull request #1342 from castrapel/dyn_dns_fix

Limit dns queries to 10 attempts
This commit is contained in:
Curtis 2018-06-14 07:49:18 -07:00 committed by GitHub
commit f88e81ffef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -41,12 +41,15 @@ def _has_dns_propagated(name, token):
def wait_for_dns_change(change_id, account_number=None):
fqdn, token = change_id
while True:
number_of_attempts = 10
for attempts in range(0, number_of_attempts):
status = _has_dns_propagated(fqdn, token)
current_app.logger.debug("Record status for fqdn: {}: {}".format(fqdn, status))
if status:
break
time.sleep(20)
if not status:
raise Exception("Unable to query DNS token for fqdn {}.".format(fqdn))
return