From 9486225e8b4850a256efca50875398320b6763fa Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Tue, 9 Jan 2024 18:25:18 +0200 Subject: [PATCH] changing the interval to 5 min + add a try except to the email sending method --- app.py | 2 +- services/EventNotifyerService.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 7cb72d6..e111798 100644 --- a/app.py +++ b/app.py @@ -27,7 +27,7 @@ class App: self.scheduler.init_app(self.app) self.scheduler.start() # Schedule the job - self.scheduler.add_job(id='notifyUpcommingEvents', func=self.notifyUpcommingEvents, trigger='interval', minutes=30) + self.scheduler.add_job(id='notifyUpcommingEvents', func=self.notifyUpcommingEvents, trigger='interval', minutes=5) print("Scheduler started") diff --git a/services/EventNotifyerService.py b/services/EventNotifyerService.py index d24bf4a..b203331 100644 --- a/services/EventNotifyerService.py +++ b/services/EventNotifyerService.py @@ -31,7 +31,11 @@ class EventNotifyerService: def notify_user(userEmail, event): - # send email to user is the email been sent, return true; otherwise, return false - return True + try: + print("User:", userEmail, "Event:", event) + return True + except: + print("Error printing user and event") + return False \ No newline at end of file