Added random number of seconds delay in script to avoid multiple domain conflicts
This commit is contained in:
@ -7,6 +7,7 @@
|
|||||||
# with certbot)
|
# with certbot)
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import random
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
from DnsRecordDeleter import delete_dns_record
|
from DnsRecordDeleter import delete_dns_record
|
||||||
@ -30,6 +31,15 @@ record = {
|
|||||||
"rrset_values": [validation_token],
|
"rrset_values": [validation_token],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Due to there being multiple subdomains being requested, this
|
||||||
|
# script will be invoked multiple times with different domain
|
||||||
|
# values. As such, to avoid conflicts, we will delay each run
|
||||||
|
# of this script a random number of seconds, between 0 and 180
|
||||||
|
# to make sure there are no conflicts between the separate
|
||||||
|
# runs of this script
|
||||||
|
random_nr = random.randrange(0, 180)
|
||||||
|
time.sleep(random_nr)
|
||||||
|
|
||||||
response = requests.post(LIVEDNS_API_URL + '/' + domain
|
response = requests.post(LIVEDNS_API_URL + '/' + domain
|
||||||
+ '/records', headers=headers, json=record)
|
+ '/records', headers=headers, json=record)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user