1
I would advise to update the querset in bulk, with .update(…)
[Django-doc]:
from django.db.models import F
@database_sync_to_async
def increment_unread(room_id):
RoomOccupier.objects.filter(room_id=room_id).update(
unread_count=F('unread_count')+1
)
return True
Source:stackexchange.com