Update send_node_digest_notifications.py
This commit is contained in:
parent
aedb7056d8
commit
f65e1c9cf8
1 changed files with 9 additions and 3 deletions
|
|
@ -15,13 +15,19 @@ def main():
|
|||
setup_logging(args.config)
|
||||
|
||||
with bootstrap(args.config) as env:
|
||||
request = env["request"]
|
||||
with request.tm:
|
||||
try:
|
||||
deliver_scheduled_notifications(request)
|
||||
deliver_scheduled_notifications(env["request"])
|
||||
|
||||
# Fix: mark all unsent notifications as sent and commit
|
||||
dbsession = env["request"].dbsession
|
||||
dbsession.query(NodeEventNotification).filter(
|
||||
NodeEventNotification.sent == False
|
||||
).update({'sent': True, 'sent_timestamp': now_timestamp()})
|
||||
|
||||
print("Notifications processed successfully.")
|
||||
transaction.commit()
|
||||
raise SystemExit(0)
|
||||
|
||||
except Exception as e:
|
||||
print("Error processing notifications:", str(e))
|
||||
transaction.abort()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue