From 31f53736528366ed2444e8c366c5468a18f897c2 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Tue, 4 Apr 2023 21:21:00 +0200 Subject: [PATCH] Await the send notifications coroutines Signed-off-by: Emmy D'Anello --- draw/consumers.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/draw/consumers.py b/draw/consumers.py index 65739cc..bf37dfc 100644 --- a/draw/consumers.py +++ b/draw/consumers.py @@ -509,9 +509,9 @@ class DrawConsumer(AsyncJsonWebsocketConsumer): {'type': 'draw.box_visibility', 'visible': True}) # Notify the team that it can draw a problem - self.channel_layer.group_send(f"team-{tds[0].participation.team.trigram}", - {'type': 'draw.notify', 'title': "À votre tour !", - 'body': "C'est à vous de tirer un nouveau problème !"}) + await self.channel_layer.group_send(f"team-{tds[0].participation.team.trigram}", + {'type': 'draw.notify', 'title': "À votre tour !", + 'body': "C'est à vous de tirer un nouveau problème !"}) async def select_problem(self, **kwargs): """ @@ -631,9 +631,9 @@ class DrawConsumer(AsyncJsonWebsocketConsumer): {'type': 'draw.box_visibility', 'visible': True}) # Notify the team that it can draw a problem - self.channel_layer.group_send(f"team-{new_trigram}", - {'type': 'draw.notify', 'title': "À votre tour !", - 'body': "C'est à vous de tirer un nouveau problème !"}) + await self.channel_layer.group_send(f"team-{new_trigram}", + {'type': 'draw.notify', 'title': "À votre tour !", + 'body': "C'est à vous de tirer un nouveau problème !"}) else: # Pool is ended if pool.size == 5: @@ -684,9 +684,9 @@ class DrawConsumer(AsyncJsonWebsocketConsumer): await self.channel_layer.group_send(f"team-{td.participation.team.trigram}", {'type': 'draw.dice_visibility', 'visible': True}) # Notify the team that it can draw a dice - self.channel_layer.group_send(f"team-{td.participation.team.trigram}", - {'type': 'draw.notify', 'title': "À votre tour !", - 'body': "C'est à vous de lancer le dé !"}) + await self.channel_layer.group_send(f"team-{td.participation.team.trigram}", + {'type': 'draw.notify', 'title': "À votre tour !", + 'body': "C'est à vous de lancer le dé !"}) await self.channel_layer.group_send(f"tournament-{self.tournament.id}", {'type': 'draw.dice_visibility', 'visible': True}) @@ -706,9 +706,9 @@ class DrawConsumer(AsyncJsonWebsocketConsumer): {'type': 'draw.dice', 'team': participation.team.trigram, 'result': None}) # Notify the team that it can draw a dice - self.channel_layer.group_send(f"team-{participation.team.trigram}", - {'type': 'draw.notify', 'title': "À votre tour !", - 'body': "C'est à vous de lancer le dé !"}) + await self.channel_layer.group_send(f"team-{participation.team.trigram}", + {'type': 'draw.notify', 'title': "À votre tour !", + 'body': "C'est à vous de lancer le dé !"}) # Reorder dices await self.channel_layer.group_send(f"tournament-{self.tournament.id}", @@ -818,9 +818,9 @@ class DrawConsumer(AsyncJsonWebsocketConsumer): {'type': 'draw.set_active', 'draw': self.tournament.draw}) # Notify the team that it can draw a problem - self.channel_layer.group_send(f"team-{new_trigram}", - {'type': 'draw.notify', 'title': "À votre tour !", - 'body': "C'est à vous de tirer un nouveau problème !"}) + await self.channel_layer.group_send(f"team-{new_trigram}", + {'type': 'draw.notify', 'title': "À votre tour !", + 'body': "C'est à vous de tirer un nouveau problème !"}) @ensure_orga @@ -896,9 +896,9 @@ class DrawConsumer(AsyncJsonWebsocketConsumer): {'type': 'draw.dice_visibility', 'visible': True}) # Notify the team that it can draw a problem - self.channel_layer.group_send(f"team-{td.participation.team.trigram}", - {'type': 'draw.notify', 'title': "À votre tour !", - 'body': "C'est à vous de tirer un nouveau problème !"}) + await self.channel_layer.group_send(f"team-{td.participation.team.trigram}", + {'type': 'draw.notify', 'title': "À votre tour !", + 'body': "C'est à vous de tirer un nouveau problème !"}) await self.channel_layer.group_send(f"volunteer-{self.tournament.id}", {'type': 'draw.dice_visibility', 'visible': True})