Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis semaphore: current count #234

Open
mesztam84 opened this issue Jan 3, 2025 · 1 comment
Open

Redis semaphore: current count #234

mesztam84 opened this issue Jan 3, 2025 · 1 comment

Comments

@mesztam84
Copy link

Hi,

is there any way to query the current number of acquired tickets of a redis semaphore? Would be great for monitoring.

@madelson
Copy link
Owner

madelson commented Jan 4, 2025

Currently there's no API for that. You can see how it would be implemented by looking at AcquireScript in RedisSemaphorePrimitive.cs; the first part is checking the count.

So one option is implementing a similar script in your code.

I also think it would be reasonable to add an API to RedisDistributedSemaphore for this:

public int GetCurrentCount();
public ValueTask<int> GetCurrentCountAsync();

I'd be happy to review and accept such a contribution.

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

No branches or pull requests

2 participants