import logging from apps.notifications.services import flush_pending_notifications from config.celery import app logger = logging.getLogger("lotty") @app.task(bind=True, name="notifications.flush_pending") def flush_pending_notifications_task(self): results = flush_pending_notifications() logger.info( "notifications_flush_completed", extra={ "sent": results["sent"], "failed": results["failed"], }, ) return results