-
Notifications
You must be signed in to change notification settings - Fork 170
Open
Description
We have implemented a retry logic in similar way like below. If I understood correctly it tries to acquire lock at every 1 second for 10 seconds till it acquire lock. But when I run the task which tries to get the lock with same below piece of code and there are tasks which are running in parallel, actually it is not giving up after 10 seconds but waiting till lock is acquired. But my understanding is which ever happens first either getting the lock or wait time expiration it has to give up trying to lock.
var resource = "the-thing-we-are-locking-on";
var expiry = TimeSpan.FromSeconds(30);
var wait = TimeSpan.FromSeconds(10);
var retry = TimeSpan.FromSeconds(1);
// blocks until acquired or 'wait' timeout
await using (var redLock = await redlockFactory.CreateLockAsync(resource, expiry, wait, retry)) // there are also non async Create() methods
{
// make sure we got the lock
if (redLock.IsAcquired)
{
// do stuff
}
}
// the lock is automatically released at the end of the using block
Issue :
Retry not given up even after the wait time.
.NET Version --- .NET 8
RedLock.net Version --- 2.3.2
SlavkaOnline
Metadata
Metadata
Assignees
Labels
No labels