lock
lock copied to clipboard
Check if the lock is taken
Hi! We encountered a situation when we would like to terminate all the calls when a locked call is already in execution (instead of waiting). @malkusch do you plan to extend the library with this feature in the near future? :+1:
You mean, testing if the lock is taken, and then aborting?
Same request here. I use predis locks. In some cases I don't want to wait until the lock is released, but abort the request if another process is already holding that lock.
Yes, check if the lock is taken and if so throw an exception
I don't have any plans to add this feature. However, I'm willing to take in any pull requests that add this feature.
If you want to create a PR for this, please discuss the interface here first.
If the Loop class had an ability to pass a flag to disable retries or set X retries instead of using timeout this could help this out etc.
Hi. I would avoid to introduce a second timeout because funky things might happen. I would suggest the use of a flag to enable/disable the loop to execute more than once or till the locks ttl expire. Is this thread active or rather do you see value in this feature?
"workaround", use Symfony Lock instead - https://symfony.com/doc/5.x/components/lock.html#usage