minor changes
This commit is contained in:
parent
ebadffecc4
commit
d36da567ef
|
@ -8,7 +8,8 @@ attachments_path: attachments
|
|||
exclude_folders:
|
||||
- Trash
|
||||
- Drafts
|
||||
- Spam
|
||||
- '[Gmail]/Trash'
|
||||
- '[Gmail]/Drafts'
|
||||
- '[Gmail]/Starred'
|
||||
- '[Gmail]/Important'
|
||||
- '[Gmail]/Important'
|
||||
|
|
|
@ -2,7 +2,6 @@ import concurrent.futures
|
|||
import email
|
||||
import imaplib
|
||||
import logging
|
||||
import sys
|
||||
from email.header import decode_header
|
||||
from email.utils import parsedate_to_datetime
|
||||
from json import JSONEncoder
|
||||
|
@ -53,7 +52,7 @@ class MailConnection:
|
|||
detected = chardet.detect(raw_email_bytes)
|
||||
except TypeError as e:
|
||||
self.logger.critical(f'Failed to decode an email. Timeout? Server error? - "{e}"')
|
||||
sys.exit(1)
|
||||
return
|
||||
encoding = detected['encoding']
|
||||
if not encoding:
|
||||
encoding = 'utf-8'
|
||||
|
@ -136,6 +135,7 @@ class MailConnection:
|
|||
first_email_id = int(id_list[0])
|
||||
latest_email_id = int(id_list[-1])
|
||||
|
||||
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=max_threads) as executor:
|
||||
futures = {executor.submit(self.__fetch_email, i) for i in range(latest_email_id, first_email_id, -1)}
|
||||
for future in concurrent.futures.as_completed(futures):
|
||||
|
|
Loading…
Reference in New Issue