From 19756f055bab644a749fc3cd437d043e22dfc535 Mon Sep 17 00:00:00 2001 From: Stefano Marinelli Date: Sat, 21 Oct 2023 10:49:50 +0200 Subject: [PATCH] Fixed concurrent DB access --- NotiMail.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/NotiMail.py b/NotiMail.py index 70362e3..0e8a7d8 100644 --- a/NotiMail.py +++ b/NotiMail.py @@ -113,13 +113,10 @@ class DatabaseHandler: def close(self): self.connection.close() -# Create a global database handler -db_handler = DatabaseHandler() - class EmailProcessor: def __init__(self, mail): self.mail = mail - self.db_handler = db_handler # Use the global db_handler + self.db_handler = DatabaseHandler() # Create a new db_handler for each instance def fetch_unseen_emails(self): status, messages = self.mail.uid('search', None, "UNSEEN") @@ -420,7 +417,6 @@ def multi_account_main(): handler.mail.logout() except: pass - processor.db_handler.close() if __name__ == "__main__": multi_account_main()