From 2a21610128e0068ae4796481169b5086a94c4ab5 Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Sun, 17 May 2026 22:50:44 +0200 Subject: [PATCH] fix(loyalty): register send_notification_email with celery worker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- app/modules/loyalty/tasks/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/modules/loyalty/tasks/__init__.py b/app/modules/loyalty/tasks/__init__.py index 7697ad53..a624efb5 100644 --- a/app/modules/loyalty/tasks/__init__.py +++ b/app/modules/loyalty/tasks/__init__.py @@ -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", ]