Skip to content

Redlock::Client.lock returns false when there is a connection issue #108

Description

@marcilioLemos

Hello, everyone. I want to use redlock to implement a rate limit so that duplicate requests within a certain time frame are dropped. According to the documentation, if an attempt to acquire a lock fails, the lock method returns false. At the same time, after rescuing exceptions, lock returns false too. Such behavior, in my opinion, is dangerous and an anti-pattern. If a client receives a false response from lock, there is no guarantee that this is because the lock has already been acquired. In the scenario described above , this behavior could result in the drop of all requests if the connection to the redis servers fails (once that Redis::BaseConnectionError is rescued).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions