Skip to content

How to distinguish Redis unavailability from lock contention in TryAcquireAsync? #242

@unzeitip

Description

@unzeitip

Hi, first of all, thank you for this great library — it’s been very helpful for us! 🙏

I have a question regarding how RedisDistributedLock.TryAcquireAsync behaves when Redis is unavailable (e.g., Redis crash, network failure, OOM).

From what I can see during my testing, when Redis is down, TryAcquireAsync seems to just return null, without throwing any exception.
This makes it hard to distinguish between:

  • the lock being already held (normal contention), and
  • Redis being unreachable (infrastructure issue).

Is there currently a way to tell these two situations apart when using TryAcquireAsync?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions