Skip to content

Commit

Permalink
feat: added message sent signal to edx ace (#292)
Browse files Browse the repository at this point in the history
* feat: added message sent signal to edx ace
  • Loading branch information
AhtishamShahid authored Aug 6, 2024
1 parent 6d883f8 commit 8f9a355
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion edx_ace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .recipient import Recipient
from .recipient_resolver import RecipientResolver

__version__ = '1.10.1'
__version__ = '1.11.0'


__all__ = [
Expand Down
3 changes: 3 additions & 0 deletions edx_ace/delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.conf import settings

from edx_ace.errors import RecoverableChannelDeliveryError
from edx_ace.signals import ACE_MESSAGE_SENT
from edx_ace.utils.date import get_current_time

LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -60,8 +61,10 @@ def deliver(channel, rendered_message, message):
message.report(f'{channel_type}_delivery_retried', num_seconds)
else:
message.report(f'{channel_type}_delivery_succeeded', True)
ACE_MESSAGE_SENT.send(sender=channel, message=message)
return

delivery_expired_report = f'{channel_type}_delivery_expired'
logger.debug(delivery_expired_report)
message.report(delivery_expired_report, get_current_time() - start_time)
ACE_MESSAGE_SENT.send(sender=channel, message=message)
7 changes: 7 additions & 0 deletions edx_ace/signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""
Signals for the edx_ace app
"""
from django.dispatch import Signal

# signal to indicate that a message has been sent using ace
ACE_MESSAGE_SENT = Signal()

0 comments on commit 8f9a355

Please sign in to comment.