Lock¶
-
class
lockmgr.models.
Lock
(name, locked_by, lock_process, locked_until, created_at, updated_at)[source]¶ -
__init__
(*args, **kwargs) Initialize self. See help(type(self)) for accurate signature.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
property
expired
¶ Property - returns
True
if the Lock is past expiry (locked_until
), otherwise False
-
property
expires_in
¶ The amount of time until this lock expires, as a
timedelta
- orNone
if it doesn’t expire
-
property
expires_seconds
¶ The amount of seconds until this lock expires as integer seconds - or
None
if it doesn’t expire
-
locked_by
¶ Name of the node / app which created this lock
-
locked_until
¶ Locks have an expiration time, to help avoid the issue of stuck locks, either due to forgetting to add cleanup code, or simply due to the app/server crashing before it can release the lock.
After a lock has expired, it’s assumed that the lock is stale and needs to be removed, and the affected resources are safe to use.
-
name
¶ Unique name of the lock, referring to what specific resource(s) is locked
-
Methods¶
Methods
|
|
|
|
|
|
|
Attributes¶
Attributes
A wrapper for a deferred-loading field. |
|
Property - returns |
|
The amount of time until this lock expires, as a |
|
The amount of seconds until this lock expires as integer seconds - or |
|
A wrapper for a deferred-loading field. |
|
Name of the node / app which created this lock |
|
Locks have an expiration time, to help avoid the issue of stuck locks, either due to forgetting to add cleanup code, or simply due to the app/server crashing before it can release the lock. |
|
Unique name of the lock, referring to what specific resource(s) is locked |
|
A wrapper for a deferred-loading field. |