celeryTasks.py
Python script, ASCII text executable
1import time 2from celery import shared_task 3from app import db 4from models import * 5 6 7@shared_task(ignore_result=False) 8def sendNotification(notificationID, users, level): 9notification = db.session.get(Notification, notificationID) 10 11for user in users: 12db.session.add(UserNotification(db.session.get(User, user), notification, level)) 13db.session.commit() 14 15return 0 # notification sent successfully 16