diff --git a/timer/consumers.py b/timer/consumers.py index 7c4091876c1b3e4ab1ab6c8111d847703a8b48b3..c750a381a37b918770c7abdf1ac79edef47167a5 100644 --- a/timer/consumers.py +++ b/timer/consumers.py @@ -8,8 +8,6 @@ from timeit import default_timer from asgiref.sync import sync_to_async from channels.generic.websocket import AsyncWebsocketConsumer -from .models import OngoingTimer - running_timer_threads = [] @@ -71,6 +69,8 @@ def tick_timer(timer, iteration: int, total_seconds: int) -> None: class TimerConsumer(AsyncWebsocketConsumer): async def connect(self) -> None: + from .models import OngoingTimer + timer_id = self.scope["url_route"]["kwargs"]["id"] timer = await sync_to_async(OngoingTimer.objects.filter(id=timer_id).first)()