mail dont lock unlock since we are just reading

This commit is contained in:
Egg 2024-10-09 16:41:38 +02:00
parent 4bba1f029a
commit bbc412a104

View file

@ -28,15 +28,11 @@ class Mailbot(Bot):
logger.error("No mbox file found.") logger.error("No mbox file found.")
self.mails = None self.mails = None
return reports return reports
try: for msg in self.mails:
self.mails.lock() if user.get_city().lower() in msg['To'].lower():
for msg in self.mails: if get_date_from_header(msg['Date']) > user.get_seen_mail():
if user.get_city().lower() in msg['To'].lower(): reports.append(make_report(msg, user))
if get_date_from_header(msg['Date']) > user.get_seen_mail(): self.mails.unlock()
reports.append(make_report(msg, user))
self.mails.unlock()
except ExternalClashError:
logger.warning("Unable to lock mbox")
return reports return reports
# post/boost Report object # post/boost Report object