You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I have one doubt regarding the use of the library in order to implement the feature of a distributed locking system
like there is one scenario
Let's say service-1 occupies a lock on resource-1 and during handling the process it goes in an infinite loop and never returns hence the lock that is acquired is never released is there any mechanism that the key that is set in the redis gets timed out and automatically delete
The text was updated successfully, but these errors were encountered:
Hi @KandarpPatel07 thanks for your interest in the library. Currently, Redis locks do operate on a timeout but they have "auto-renewal" set up such that the process holding the lock will periodically re-up the timeout if the lock has not been released. Typically, you don't want the process holding the lock to silently lose it just because an operation took longer than expected.
That said, if you want to mandate an absolute timeout for the lock hold, today you can do so like this:
await using (var handle = await myDistributedLock.AcquireAsync())
{
// force-release the lock after 10 minutes
Task.Delay(TimeSpan.FromMinutes(10)).ContinueWith(_ => handle.Dispose());
// potential infinite loop here
}
If there was sufficient interest, potentially this could be built directly into the library as a new option.
Hi
I have one doubt regarding the use of the library in order to implement the feature of a distributed locking system
like there is one scenario
Let's say service-1 occupies a lock on resource-1 and during handling the process it goes in an infinite loop and never returns hence the lock that is acquired is never released is there any mechanism that the key that is set in the redis gets timed out and automatically delete
The text was updated successfully, but these errors were encountered: