From 186392a80160354d196f5be952f7927a0a7e9455 Mon Sep 17 00:00:00 2001 From: jedi Date: Fri, 26 Apr 2024 01:13:18 +0200 Subject: [PATCH] stash --- core/mail/notifications.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/mail/notifications.py b/core/mail/notifications.py index 1a24cbf..f41f816 100644 --- a/core/mail/notifications.py +++ b/core/mail/notifications.py @@ -3,6 +3,7 @@ from channels.layers import get_channel_layer class NotificationDispatcher: channel_layer = None + channel_name = None def __init__(self): self.channel_layer = get_channel_layer() @@ -12,9 +13,11 @@ class NotificationDispatcher: async def run_forever(self): # Infinite loop to continuously listen for messages print("Listening for messages...") + self.channel_name = await self.channel_layer.new_channel() + print("Channel name:", self.channel_name) while True: # Blocking receive to get the message from the channel layer - message = await self.channel_layer.receive('general') + message = await self.channel_layer.receive(self.channel_name) if message: # Process the received message