This commit is contained in:
zty 2024-07-29 16:16:09 +08:00
parent ef0e55ecc0
commit 7a96810c5f
1 changed files with 1 additions and 1 deletions

View File

@ -730,7 +730,7 @@ class ExamRecordViewSet(ListModelMixin, DestroyModelMixin, RetrieveModelMixin, G
def acquire_lock(lock_name, timeout=60): def acquire_lock(lock_name, timeout=60):
identifier = str(uuid.uuid4()) identifier = str(uuid.uuid4())
lock = cache.set(lock_name, identifier, timeout=timeout, nx=True) lock = cache.set(lock_name, identifier, timeout=timeout)
return identifier if lock else None return identifier if lock else None
def release_lock(lock_name, identifier): def release_lock(lock_name, identifier):