Skip to content

Commit

Permalink
update sync_to_async to database_sync_to_async (https://channels.read…
Browse files Browse the repository at this point in the history
  • Loading branch information
aidin-leo committed Jan 13, 2021
1 parent 0bd625d commit 692473c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions celery_progress/websockets/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ 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
from channels.db import database_sync_to_async
await self.channel_layer.group_send(
self.task_id,
{
'type': 'update_task_progress',
'data': await sync_to_async(Progress(AsyncResult(self.task_id)).get_info, thread_sensitive=True)()
'data': await database_sync_to_async(Progress(AsyncResult(self.task_id)).get_info)()
}
)

Expand Down

0 comments on commit 692473c

Please sign in to comment.