sb_lock
azure_bootstrap.sb_lock
¶
Service Bus message-lock management.
AutoLockRenewer defaults are conservative; this wrapper bounds its
lifetime and ensures .close() is called on every path. Swallows
construction failures — the renewer is a defense against long-running
handlers exceeding the lock duration, not a correctness gate.
Classes:
| Name | Description |
|---|---|
ManagedLock |
OO variant of :func: |
Functions:
| Name | Description |
|---|---|
lock_for_process |
Register the message with an AutoLockRenewer for the block's duration. |
ManagedLock
¶
ManagedLock(receiver: Any, msg: Any, *, max_lock_renewal_seconds: int = DEFAULT_MAX_LOCK_RENEWAL_SECONDS)
OO variant of :func:lock_for_process.
Useful when callers need to extend the lock explicitly across multi-stage pipelines. Supports the context-manager protocol too.
Source code in azure_bootstrap/sb_lock/__init__.py
lock_for_process
¶
lock_for_process(receiver: Any, msg: Any, *, max_lock_renewal_seconds: int = DEFAULT_MAX_LOCK_RENEWAL_SECONDS) -> Generator[None, None, None]
Register the message with an AutoLockRenewer for the block's duration.