mirror of https://gitlab.crans.org/bde/nk20
🐛 Fix infinite loop in permission check
This commit is contained in:
parent
f870af139e
commit
58fe8914cf
|
@ -45,12 +45,11 @@ class InstancedPermission:
|
||||||
else:
|
else:
|
||||||
oldpk = obj.pk
|
oldpk = obj.pk
|
||||||
# Ensure previous models are deleted
|
# Ensure previous models are deleted
|
||||||
count = 0
|
for ignored in range(1000):
|
||||||
while count < 1000:
|
|
||||||
if self.model.model_class().objects.filter(pk=obj.pk).exists():
|
if self.model.model_class().objects.filter(pk=obj.pk).exists():
|
||||||
# If the object exists, that means that one permission is currently checked.
|
# If the object exists, that means that one permission is currently checked.
|
||||||
# We wait before the other permission, at most 1 second.
|
# We wait before the other permission, at most 1 second.
|
||||||
sleep(1)
|
sleep(0.001)
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
for o in self.model.model_class().objects.filter(pk=obj.pk).all():
|
for o in self.model.model_class().objects.filter(pk=obj.pk).all():
|
||||||
|
|
Loading…
Reference in New Issue