-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Sometimes it's useful to use an index in the database as a lock:
events = db['events']
items = events['items']
with events['lock']:
new_uuid = str(uuid4())
if len(items) > 0:
items[-1]['next_uuid'] = new_uuid
items.append({'data': 'abc', 'next_uuid': None})db['events']['lock'] would just be a bool and the request would wait for the bool to become false, change it to true, and then return, waiting for a followup request to set it back to false.
Alternatively, this could be generalized to a type of request that waits for a value to change.
Metadata
Metadata
Assignees
Labels
No labels