mirror of
https://github.com/django/daphne.git
synced 2025-04-21 01:02:06 +03:00
Add select_for_update() to improve isolation
This commit is contained in:
parent
732167282b
commit
4504eb6ec9
|
@ -60,7 +60,7 @@ class DatabaseChannelLayer(object):
|
|||
while True:
|
||||
try:
|
||||
with transaction.atomic():
|
||||
message = self.channel_model.objects.filter(channel__in=channels).order_by("id").first()
|
||||
message = self.channel_model.objects.select_for_update().filter(channel__in=channels).order_by("id").first()
|
||||
if message:
|
||||
self.channel_model.objects.filter(pk=message.pk).delete()
|
||||
return message.channel, self.deserialize(message.content)
|
||||
|
|
Loading…
Reference in New Issue
Block a user