From e88bbc75f3a13d3f11824827c00e55f1258c46eb Mon Sep 17 00:00:00 2001 From: jedi Date: Fri, 26 Apr 2024 00:56:12 +0200 Subject: [PATCH] stash --- core/mail/notifications.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/mail/notifications.py b/core/mail/notifications.py index 3e77126..1a24cbf 100644 --- a/core/mail/notifications.py +++ b/core/mail/notifications.py @@ -6,12 +6,10 @@ class NotificationDispatcher: def __init__(self): self.channel_layer = get_channel_layer() - - async def dispatch(self, message): - print("Dispatching message:", message) + if not self.channel_layer: + raise Exception("Could not get channel layer") async def run_forever(self): - # Infinite loop to continuously listen for messages print("Listening for messages...") while True: @@ -22,3 +20,6 @@ class NotificationDispatcher: # Process the received message print("Received message:", message) await self.dispatch(message) + + async def dispatch(self, message): + print("Dispatching message:", message)