Skip to content

Is there a way to check if a lock exists? #120

Description

@dstj

Is there a way to only verify if a lock is present (i.e. the protected process is running)?

I want to do if (redLock.IsAcquired) but without actually trying to acquire a lock.

Something like this code maybe:

var lockExists = await redlockFactory.CheckForExistingLockAsync(resource);

My use case is that I have a background process that runs a long-running operation and a foreground process that enqueues process requests in RabbitMQ. If the process is already running, I would enqueue another request that I know if going to be refused.

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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