Skip to content

Commit 1468b13

Browse files
fix(lock): async release
1 parent 6e782ac commit 1468b13

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

redis/asyncio/lock.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,10 @@ def release(self) -> Awaitable[None]:
249249
"""Releases the already acquired lock"""
250250
expected_token = self.local.token
251251
if expected_token is None:
252-
raise LockError("Cannot release an unlocked lock")
252+
raise LockError(
253+
"Cannot release a lock that's not owned or is already unlocked.",
254+
lock_name=self.name,
255+
)
253256
self.local.token = None
254257
return self.do_release(expected_token)
255258

0 commit comments

Comments
 (0)