1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-24 19:07:23 +01:00

retrying dns timeouts

This commit is contained in:
KiekerJan
2022-04-04 22:31:54 +02:00
parent 7ac4b412b0
commit 9b252e0209
2 changed files with 18 additions and 5 deletions

View File

@@ -1102,7 +1102,7 @@ def set_secondary_dns(hostnames, env):
if len(hostnames) > 0:
# Validate that all hostnames are valid and that all zone-xfer IP addresses are valid.
resolver = dns.resolver.get_default_resolver()
resolver.timeout = 6
resolver.timeout = 3
for item in hostnames:
if not item.startswith("xfr:"):
# Resolve hostname.
@@ -1115,7 +1115,7 @@ def set_secondary_dns(hostnames, env):
except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
raise ValueError("Could not resolve the IP address of %s." % item)
except (dns.resolver.Timeout):
resolver.timeout = 7
resolver.timeout = 5
logging.warning('Timeout on resolving ipv4 address re-trying')
try:
response = resolver.resolve(item, "A")
@@ -1127,7 +1127,7 @@ def set_secondary_dns(hostnames, env):
raise ValueError("Could not resolve the IP address of %s." % item)
except (dns.resolver.Timeout):
raise ValueError("Could not resolve the IP address of %s due to timeout." % item)
resolver.timeout = 6
resolver.timeout = 3
else:
# Validate IP address.
try: