Skip to content

Commit 0bd625d

Browse files
committed
Hotfix support for django_db for celery backend (specially for django_celery_results)
1 parent a762315 commit 0bd625d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

celery_progress/websockets/consumers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ async def receive(self, text_data):
2727
task_type = text_data_json['type']
2828

2929
if task_type == 'check_task_completion':
30+
from asgiref.sync import sync_to_async
3031
await self.channel_layer.group_send(
3132
self.task_id,
3233
{
3334
'type': 'update_task_progress',
34-
'data': Progress(AsyncResult(self.task_id)).get_info()
35+
'data': await sync_to_async(Progress(AsyncResult(self.task_id)).get_info, thread_sensitive=True)()
3536
}
3637
)
3738

0 commit comments

Comments
 (0)