Timeouts seems not work in DistributedLock.Redis
See original GitHub issuethere is no -1 return after 5 seconds but after almost 30 seconds.
await using var handle =await _lockProvider.TryAcquireLockAsync("MyLockName", TimeSpan.FromSeconds(5));
if (handle != null)
{
await Task.Delay(TimeSpan.FromSeconds(500));
return 1;
}
else
{
return -1;
}
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Redis distributed lock does not take effect
1 Answer. The problem seems to be with the lock function. It does not check if the value existed or not, it just...
Read more >Distributed Locks with Redis
Distributed locks are a very useful primitive in many environments where different processes must operate with shared resources in a mutually exclusive way....
Read more >Am I missing why a distributed lock is an impossibility? ...
The short answer is because if the lock holder fails your other nodes have no way of knowing if the lock holder failed...
Read more >6.2.5 Locks with timeouts | Redis
In order to give our lock a timeout, we'll use EXPIRE to have Redis time it out automatically. The natural place to put...
Read more >handling redis lock timeouts #77 - sqlalchemy/dogpile.cache
So i set the lock_timeout, and that solves one problem, but creates another – if the process ends up completing after the lock_timeout,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Many thanks madelson!
I get the same behavior as you describe in release mode.
It’s weird ☺.
Appreciate the confirmation @ccccccmd . I’m closing this issue for now since it doesn’t appear to be specific to this library. It will be interesting to see what MSFT says.