mirror of
https://github.com/draga79/NotiMail.git
synced 2024-09-19 11:04:20 +02:00
Fixed concurrent DB access
This commit is contained in:
parent
98b14dbf8f
commit
19756f055b
1 changed files with 1 additions and 5 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue