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

Method extend

redis/asyncio/lock.py:296–313  ·  view source on GitHub ↗

Adds more time to an already acquired lock. ``additional_time`` can be specified as an integer or a float, both representing the number of seconds to add. ``replace_ttl`` if False (the default), add `additional_time` to the lock's existing ttl. If True, rep

(
        self, additional_time: Number, replace_ttl: bool = False
    )

Source from the content-addressed store, hash-verified

294 raise LockNotOwnedError("Cannot release a lock that's no longer owned")
295
296 def extend(
297 self, additional_time: Number, replace_ttl: bool = False
298 ) -> Awaitable[Literal[True]]:
299 """
300 Adds more time to an already acquired lock.
301
302 ``additional_time`` can be specified as an integer or a float, both
303 representing the number of seconds to add.
304
305 ``replace_ttl`` if False (the default), add `additional_time` to
306 the lock's existing ttl. If True, replace the lock's ttl with
307 `additional_time`.
308 """
309 if self.local.token is None:
310 raise LockError("Cannot extend an unlocked lock")
311 if self.timeout is None:
312 raise LockError("Cannot extend a lock with no timeout")
313 return self.do_extend(additional_time, replace_ttl)
314
315 async def do_extend(self, additional_time, replace_ttl) -> Literal[True]:
316 additional_time = int(additional_time * 1000)

Callers 15

mset_nonatomicMethod · 0.45
observable_callbackFunction · 0.45
observable_callbackFunction · 0.45
client_kill_filterMethod · 0.45
client_trackingMethod · 0.45
command_listMethod · 0.45
migrateMethod · 0.45
memory_usageMethod · 0.45
hotkeys_startMethod · 0.45
commandMethod · 0.45
bitfield_roMethod · 0.45
copyMethod · 0.45

Calls 2

do_extendMethod · 0.95
LockErrorClass · 0.90

Tested by

no test coverage detected