fix(kfet/open): Wrap sync function for async use
This commit is contained in:
parent
9ec07f426c
commit
e4e6dfe7c6
1 changed files with 3 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
from asgiref.sync import sync_to_async
|
||||||
|
|
||||||
from ..decorators import kfet_is_team
|
from ..decorators import kfet_is_team
|
||||||
from ..utils import DjangoJsonWebsocketConsumer, PermConsumerMixin
|
from ..utils import DjangoJsonWebsocketConsumer, PermConsumerMixin
|
||||||
from .open import kfet_open
|
from .open import kfet_open
|
||||||
|
@ -19,7 +21,7 @@ class OpenKfetConsumer(PermConsumerMixin, DjangoJsonWebsocketConsumer):
|
||||||
"""Send current status on connect."""
|
"""Send current status on connect."""
|
||||||
await super().connect()
|
await super().connect()
|
||||||
|
|
||||||
group = "team" if kfet_is_team(self.user) else "base"
|
group = "team" if await sync_to_async(kfet_is_team)(self.user) else "base"
|
||||||
|
|
||||||
await self.channel_layer.group_add(f"kfet.open.{group}", self.channel_name)
|
await self.channel_layer.group_add(f"kfet.open.{group}", self.channel_name)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue