There should be a way to enter a named critical section with coco SQL client. Something similar to this API or an easier way to do this:
let lock = await db.lock("database.customLockName", leaseTimeoutMS);
// do my critical section things
await lock.extend(leaseTimeoutMS); // taking longer time than expected, increase lock lease time
// do my critical section things
await lock.release();
leaseTimeoutMS should be application controlled as it depends on program correctness requirements and can be infinite.
- If deadlock arises, it will be an application task to recover.
- DB resources will not be spent to maintain locks. The locking compute will be fully maintained at the client lib.
There should be a way to enter a named critical section with coco SQL client. Something similar to this API or an easier way to do this:
leaseTimeoutMSshould be application controlled as it depends on program correctness requirements and can be infinite.