class documentation

Mechanism that automatically locks given RemoteLock instance.

Will try to lock again after the RemoteLock is lost of any reason (i.e. connection lost, kicked by user with higher priority).

Method __init__ Create a new AutoLock instance.
Async Method lock Start automatic locking.
Async Method on_locking_user_changed Schedule lock task because the locking user changed.
Async Method on_renew_due Schedule lock renew task because we don't want to lose the lock.
Async Method unlock Stop automatic locking and release the lock if we hold it.
Instance Variable logger Undocumented
Property is_active Return whether the auto lock is active or not.
Async Method _lock_once Undocumented
Async Method _renew Undocumented
Method _schedule_lock Undocumented
Instance Variable _active Undocumented
Instance Variable _break_lock Undocumented
Instance Variable _interval Undocumented
Instance Variable _lock Undocumented
Instance Variable _lock_task Undocumented
Instance Variable _renew_task Undocumented
def __init__(self, lock: RemoteLock, *, break_lock: bool = False, interval: float = 1.0):

Create a new AutoLock instance.

Parameters
lock:RemoteLockThe RemoteLock instance to automatically lock.
break_lock:boolWhether to use RemoteLock.break_lock() instead of RemoteLock.init_lock().
interval:floatHow many seconds between two consecutive lock attempts.
async def lock(self, *, blocking: bool = True):

Start automatic locking.

Parameters
blocking:boolWhether to block until we own our lock.
async def on_locking_user_changed(self, _lock: RemoteLock, username: str):

Schedule lock task because the locking user changed.

async def on_renew_due(self, _lock: RemoteLock, remaining_ms: float):

Schedule lock renew task because we don't want to lose the lock.

async def unlock(self):

Stop automatic locking and release the lock if we hold it.

logger =

Undocumented

@property
is_active: bool =

Return whether the auto lock is active or not.

async def _lock_once(self):

Undocumented

async def _renew(self):

Undocumented

def _schedule_lock(self):

Undocumented

_active: bool =

Undocumented

_break_lock: bool =

Undocumented

_interval: float =

Undocumented

_lock: RemoteLock =

Undocumented

_lock_task: asyncio.Task[None] | None =

Undocumented

_renew_task: asyncio.Task[None] | None =

Undocumented