Integrate timeouts into lock acqusition #2
Labels
development
Standard development
r&d:polykey:core activity 1
Secret Vault Sharing and Secret History Management
Specification
If we need to be able to "retry" locking due to deadlocks MatrixAI/Polykey#294 (comment).
Then we would need to integrate the
withTimeout
andtryAcquire
decorators fromasync-mutex
. They can be represented with parameters to ouracquireRead
andacquireWrite
. But that would also mean we have to lambda-abstract them.Note that when timed out, an exception is thrown. We don't actually retry here. It is up to the user of the lock to attempt to call again, in case they need some random jitter delay.
We can keep the
acquireRead
method if we want to preserve the API. Or expect users to just dothis.read()
andthis.write()
with the relevant timeouts.Additional context
Tasks
withTimeout
andtryAcquire
fromasync-mutex
read
andwrite
methods that have atimeout
parameterwithF([rwLock.read(1000)], async ([lock]) => ...)
withRead
andwithWrite
variants too as the second parameter afterf
andg
for function and generator variants.The text was updated successfully, but these errors were encountered: