Some checks failed
The notifications task module was never imported by the loyalty.tasks package __init__, so celery's discovery walk loaded the package but never executed the @shared_task decorator on send_notification_email. The task was missing from the worker's [tasks] registry, so every .delay() call resulted in NotRegistered on the worker side — message ACKed, task silently dropped, no email_logs row written. Add the import (and update the module docstring / __all__) so the task is registered alongside the other loyalty background tasks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
27 lines
974 B
Python
27 lines
974 B
Python
# app/modules/loyalty/tasks/__init__.py
|
|
"""
|
|
Loyalty module Celery tasks.
|
|
|
|
Background tasks for:
|
|
- Transactional notification emails (enrollment, welcome bonus, reward
|
|
ready, points expiring/expired) — dispatched on-demand by services
|
|
- Point expiration (daily at 02:00)
|
|
- Wallet synchronization (hourly)
|
|
|
|
Task registration is handled by the module definition in definition.py
|
|
which specifies the task paths and schedules. The imports below must
|
|
mention every task module that defines a @shared_task — otherwise the
|
|
celery worker's task-discovery walk imports the package but never sees
|
|
the decorated function, so calls to .delay() fail with NotRegistered.
|
|
"""
|
|
|
|
from app.modules.loyalty.tasks.notifications import send_notification_email
|
|
from app.modules.loyalty.tasks.point_expiration import expire_points
|
|
from app.modules.loyalty.tasks.wallet_sync import sync_wallet_passes
|
|
|
|
__all__ = [
|
|
"expire_points",
|
|
"send_notification_email",
|
|
"sync_wallet_passes",
|
|
]
|