diff --git a/celery_progress/websockets/consumers.py b/celery_progress/websockets/consumers.py index 5b3dcd3..a2bcc3b 100644 --- a/celery_progress/websockets/consumers.py +++ b/celery_progress/websockets/consumers.py @@ -27,11 +27,13 @@ async def receive(self, text_data): task_type = text_data_json['type'] if task_type == 'check_task_completion': + from asgiref.sync import sync_to_async + progress = Progress(AsyncResult(self.task_id)) await self.channel_layer.group_send( self.task_id, { 'type': 'update_task_progress', - 'data': Progress(AsyncResult(self.task_id)).get_info() + 'data': await sync_to_async(progress.get_info, thread_sensitive=True)() } )