We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a8a1ce7 commit 3b64e66Copy full SHA for 3b64e66
redis/lock.py
@@ -251,13 +251,7 @@ def release(self) -> None:
251
"""
252
expected_token = self.local.token
253
if expected_token is None:
254
- if self.owned():
255
- raise LockError("Cannot release an unlocked lock", lock_name=self.name)
256
- else:
257
- raise LockNotOwnedError(
258
- "Cannot release a lock that's no longer owned",
259
- lock_name=self.name,
260
- )
+ raise LockError("Cannot release a lock that's not owned or is already unlocked.", lock_name=self.name)
261
self.local.token = None
262
self.do_release(expected_token)
263
0 commit comments