Forum Discussion

Rushabh1035's avatar
Rushabh1035
New Contributor
6 years ago

Is there a way to check if there's already a distributed lock in consul for particular lock name?

I'm trying to check if there's a distributed lock in consul for a particular lock name using consul client (https://www.nuget.org/packages/Consul/).

Currently the only way to achieve it is to try to acquire a lock for that lock name, using ConsulClient.AcquireLock(). However if the lock exists AcquireLock method doesn't return a result, but instead waits for the consul lock to be released and right then locks it and returns a result.

await new ConsulClient().AcquireLock("lockNameExample");

Is there a way to retrieve the list of all consul locks or maybe some other way to check if there's a lock in consul for the given lock name?

  • Hi Rushab, a little lost on your exact question. I have a few questions - 

    1) Are you currently using SmartBear LoadNinja? If yes, can you please share your username in our support channel - https://support.smartbear.com/message/?prod=loadninja

    2) Is there a screenshot/video of exactly what you're trying to accompolish?