fix(loyalty): register send_notification_email with celery worker
Some checks failed
CI / ruff (push) Successful in 18s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

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>
This commit is contained in:
2026-05-17 22:50:44 +02:00
parent 3e650ff863
commit 2a21610128

View File

@@ -3,17 +3,24 @@
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.
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",
]