PostgreSQL's advisory locks offers users a handy tool.
Add a lock interface that is consistent with threading's Lock():
l = db.lock()
Creates a lock object with a generated identifier
il = db.lock('explicit_id')
Creates a lock object with an explicit identifier.
Will need to derive an numeric ID from the string.
From there, l and il must support the methods provided by Lock():
l.acquire([blocking = 1])
l.release()
Additionaly, CM interfaces:
with l:
...
Where l.enter is consistent with l.acquire(blocking = True).
PostgreSQL's advisory locks offers users a handy tool.
Add a lock interface that is consistent with threading's Lock():
l = db.lock()
Creates a lock object with a generated identifier
il = db.lock('explicit_id')
Creates a lock object with an explicit identifier.
Will need to derive an numeric ID from the string.
From there, l and il must support the methods provided by Lock():
l.acquire([blocking = 1])
l.release()
Additionaly, CM interfaces:
with l:
...
Where l.enter is consistent with l.acquire(blocking = True).