Merge branch 'fix_notification_emails' into 'main'

Fix notification emails

See merge request engineering/remarkbox/remarkbox!19
This commit is contained in:
Groupr 2025-06-07 16:26:23 +00:00
commit e148141fce
2 changed files with 12 additions and 8 deletions

View file

@ -166,7 +166,7 @@ def deliver_scheduled_notifications(request=None):
if datetime.today().weekday() == 0:
notification_dict = get_email_notifications(request.dbsession, "weekly")
send_digest_notifications(request, notification_dict, "weekly")
def send_immediate_notifications(request, notifications):
deliver_email_notifications = request.app.get("deliver_email_notifications", True)

View file

@ -15,13 +15,17 @@ def main():
setup_logging(args.config)
with bootstrap(args.config) as env:
try:
deliver_scheduled_notifications()
print("Notifications processed successfully.")
raise SystemExit(0)
except Exception as e:
print("Error processing notifications:", str(e))
raise SystemExit(1)
request = env["request"]
with request.tm:
try:
deliver_scheduled_notifications()
print("Notifications processed successfully.")
transaction.commit()
raise SystemExit(0)
except Exception as e:
print("Error processing notifications:", str(e))
transaction.abort()
raise SystemExit(1)
if __name__ == "__main__":
main()