DRY-up conditionally creating callback tasks

This removes 3 duplicate instances of the same code, which is still
tested implicitly via test_process_ses_receipt_tasks [1]. In the
next commit we'll make this test more explicit, to reflect that it's
now being reused elsewhere and shouldn't change arbitrarily.

We do lose the "print" statement from the command instance of the
code, but I think that's a very tolerable loss.

[1]: 16ec8ccb8a/tests/app/celery/test_process_ses_receipts_tasks.py (L94)
This commit is contained in:
Ben Thorner
2021-11-26 15:18:53 +00:00
parent aea555fce2
commit 04da017558
8 changed files with 25 additions and 117 deletions

View File

@@ -11,8 +11,8 @@ from app.config import QueueNames
from app.dao import notifications_dao
from app.models import NOTIFICATION_PENDING, NOTIFICATION_SENDING
from app.notifications.notifications_ses_callback import (
_check_and_queue_callback_task,
_check_and_queue_complaint_callback_task,
check_and_queue_callback_task,
determine_notification_bounce_type,
handle_complaint,
)
@@ -76,7 +76,7 @@ def process_ses_results(self, response):
notification.sent_at
)
_check_and_queue_callback_task(notification)
check_and_queue_callback_task(notification)
return True