Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry Logic not working as Expected #114

Open
yandrapragada opened this issue Jul 17, 2024 · 0 comments
Open

Retry Logic not working as Expected #114

yandrapragada opened this issue Jul 17, 2024 · 0 comments

Comments

@yandrapragada
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant