mirror of
https://github.com/draga79/NotiMail.git
synced 2024-11-09 23:51:07 +01: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):
|
def close(self):
|
||||||
self.connection.close()
|
self.connection.close()
|
||||||
|
|
||||||
# Create a global database handler
|
|
||||||
db_handler = DatabaseHandler()
|
|
||||||
|
|
||||||
class EmailProcessor:
|
class EmailProcessor:
|
||||||
def __init__(self, mail):
|
def __init__(self, mail):
|
||||||
self.mail = 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):
|
def fetch_unseen_emails(self):
|
||||||
status, messages = self.mail.uid('search', None, "UNSEEN")
|
status, messages = self.mail.uid('search', None, "UNSEEN")
|
||||||
|
@ -420,7 +417,6 @@ def multi_account_main():
|
||||||
handler.mail.logout()
|
handler.mail.logout()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
processor.db_handler.close()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
multi_account_main()
|
multi_account_main()
|
||||||
|
|
Loading…
Reference in a new issue