MCPcopy
hub / github.com/redis/redis-py / release

Method release

redis/lock.py:265–276  ·  view source on GitHub ↗

Releases the already acquired lock

(self)

Source from the content-addressed store, hash-verified

263 return self.local.token is not None and stored_token == self.local.token
264
265 def release(self) -> None:
266 """
267 Releases the already acquired lock
268 """
269 expected_token = self.local.token
270 if expected_token is None:
271 raise LockError(
272 "Cannot release a lock that's not owned or is already unlocked.",
273 lock_name=self.name,
274 )
275 self.local.token = None
276 self.do_release(expected_token)
277
278 def do_release(self, expected_token: str) -> None:
279 if not bool(

Callers 15

__exit__Method · 0.95
targetMethod · 0.45
test_lockMethod · 0.45
_test_lock_tokenMethod · 0.45
test_lockedMethod · 0.45
_test_ownedMethod · 0.45
test_competing_locksMethod · 0.45
test_timeoutMethod · 0.45
test_float_timeoutMethod · 0.45
test_blocking_timeoutMethod · 0.45

Calls 2

do_releaseMethod · 0.95
LockErrorClass · 0.90

Tested by 15

targetMethod · 0.36
test_lockMethod · 0.36
_test_lock_tokenMethod · 0.36
test_lockedMethod · 0.36
_test_ownedMethod · 0.36
test_competing_locksMethod · 0.36
test_timeoutMethod · 0.36
test_float_timeoutMethod · 0.36
test_blocking_timeoutMethod · 0.36