Skip to content

Commit f4d6e97

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

celery_progress/websockets/consumers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ 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
31+
progress = Progress(AsyncResult(self.task_id))
3032
await self.channel_layer.group_send(
3133
self.task_id,
3234
{
3335
'type': 'update_task_progress',
34-
'data': Progress(AsyncResult(self.task_id)).get_info()
36+
'data': await sync_to_async(progress.get_info, thread_sensitive=True)()
3537
}
3638
)
3739

0 commit comments

Comments
 (0)