use stealth_sync
This commit is contained in:
+12
-2
@@ -139,6 +139,14 @@ def need_to_valid_url(url: str, successful_items) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def need_to_check_email(mail: str, successful_items) -> bool:
|
||||
for item in successful_items:
|
||||
if item.email == mail:
|
||||
if item.url_validated is not None:
|
||||
return not item.url_validated
|
||||
return True
|
||||
|
||||
|
||||
def read_mails():
|
||||
# get email address
|
||||
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
||||
@@ -154,8 +162,10 @@ def read_mails():
|
||||
mails_messages = []
|
||||
with ThreadPoolExecutor(max_workers=20) as executor:
|
||||
for mail in mail_list:
|
||||
mail_reader = MailReader(mail.mail, mail.password)
|
||||
executor.submit(mail_reader.read_emails, mails_messages)
|
||||
# check whether we need to read mail
|
||||
if need_to_check_email(mail, successful_items):
|
||||
mail_reader = MailReader(mail.mail, mail.password)
|
||||
executor.submit(mail_reader.read_emails, mails_messages)
|
||||
|
||||
with ThreadPoolExecutor(max_workers=20) as executor:
|
||||
for mail in mails_messages:
|
||||
|
||||
Reference in New Issue
Block a user