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

Method do_acquire

redis/lock.py:237–245  ·  view source on GitHub ↗
(self, token: str)

Source from the content-addressed store, hash-verified

235 mod_time.sleep(sleep)
236
237 def do_acquire(self, token: str) -> bool:
238 if self.timeout:
239 # convert to milliseconds
240 timeout = int(self.timeout * 1000)
241 else:
242 timeout = None
243 if self.redis.set(self.name, token, nx=True, px=timeout):
244 return True
245 return False
246
247 def locked(self) -> bool:
248 """

Callers 1

acquireMethod · 0.95

Calls 1

setMethod · 0.45

Tested by

no test coverage detected