-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: send doc event emails via celery (#7680)
* feat: notify_event_to_subscribers_task * fix: avoid circular import, handle error * fix: don't queue task in test mode * fix: don't even send mail in test mode * test: separately test signal * fix: if/else error * test: better naming * test: test the new task * test: better test name * test: refactor notify email test * fix: save, not update * test: restore template coverage
- Loading branch information
1 parent
877e842
commit f1d58da
Showing
3 changed files
with
119 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright The IETF Trust 2024, All Rights Reserved | ||
from celery import shared_task | ||
|
||
from ietf.doc.models import DocEvent | ||
from ietf.utils.log import log | ||
|
||
|
||
@shared_task | ||
def notify_event_to_subscribers_task(event_id): | ||
from .utils import notify_event_to_subscribers | ||
event = DocEvent.objects.filter(pk=event_id).first() | ||
if event is None: | ||
log(f"Unable to send subscriber notifications because DocEvent {event_id} was not found") | ||
else: | ||
notify_event_to_subscribers(event) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters