mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
fix: [Mails dns resolver] update timeout exception
This commit is contained in:
parent
3f5fc85536
commit
fa35bfc252
1 changed files with 7 additions and 6 deletions
|
@ -4,6 +4,7 @@ import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import dns.resolver
|
import dns.resolver
|
||||||
|
import dns.exception
|
||||||
|
|
||||||
from pubsublogger import publisher
|
from pubsublogger import publisher
|
||||||
|
|
||||||
|
@ -45,8 +46,8 @@ def checking_MX_record(r_serv, MXdomains, addr_dns):
|
||||||
num = len(MXdomains)
|
num = len(MXdomains)
|
||||||
resolver = dns.resolver.Resolver()
|
resolver = dns.resolver.Resolver()
|
||||||
resolver.nameservers = [addr_dns]
|
resolver.nameservers = [addr_dns]
|
||||||
resolver.timeout = 5
|
resolver.timeout = 5.0
|
||||||
resolver.lifetime = 2
|
resolver.lifetime = 2.0
|
||||||
if MXdomains != []:
|
if MXdomains != []:
|
||||||
|
|
||||||
for MXdomain in MXdomains:
|
for MXdomain in MXdomains:
|
||||||
|
@ -90,8 +91,8 @@ def checking_MX_record(r_serv, MXdomains, addr_dns):
|
||||||
publisher.debug('The Label is too long')
|
publisher.debug('The Label is too long')
|
||||||
print('The Label is too long')
|
print('The Label is too long')
|
||||||
|
|
||||||
except dns.resolver.Timeout:
|
except dns.exception.Timeout:
|
||||||
print('timeout')
|
print('dns timeout')
|
||||||
r_serv.setex(MXdomain, 1, timedelta(days=1))
|
r_serv.setex(MXdomain, 1, timedelta(days=1))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -109,8 +110,8 @@ def checking_A_record(r_serv, domains_set):
|
||||||
WalidA = set([])
|
WalidA = set([])
|
||||||
resolver = dns.resolver.Resolver()
|
resolver = dns.resolver.Resolver()
|
||||||
resolver.nameservers = [dns_server]
|
resolver.nameservers = [dns_server]
|
||||||
resolver.timeout = 5
|
resolver.timeout = 5.0
|
||||||
resolver.lifetime = 2
|
resolver.lifetime = 2.0
|
||||||
|
|
||||||
for Adomain in domains_set:
|
for Adomain in domains_set:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue