MCPcopy
hub / github.com/SpiderClub/haipproxy / release_lock

Function release_lock

utils/redis_util.py:35–53  ·  view source on GitHub ↗
(conn, lock_name, identifier)

Source from the content-addressed store, hash-verified

33
34
35def release_lock(conn, lock_name, identifier):
36 pipe = conn.pipeline(True)
37 lock_name = LOCKER_PREFIX + lock_name
38 while True:
39 try:
40 pipe.watch(lock_name)
41 identifier_origin = pipe.get(lock_name).decode()
42 if identifier_origin == identifier:
43 pipe.multi()
44 pipe.delete(lock_name)
45 pipe.execute()
46 return True
47 pipe.unwatch()
48 break
49
50 except redis.exceptions.WatchError:
51 pass
52
53 return False

Callers 2

Calls 1

getMethod · 0.80

Tested by

no test coverage detected