Skip to content

Instantly share code, notes, and snippets.

@lgolubyev
Created July 18, 2022 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgolubyev/9a2c09076f5c1e5c17a8e249c87eb674 to your computer and use it in GitHub Desktop.
Save lgolubyev/9a2c09076f5c1e5c17a8e249c87eb674 to your computer and use it in GitHub Desktop.
public abstract class RateLimiter : IAsyncDisposable, IDisposable
{
public abstract int GetAvailablePermits();
public abstract TimeSpan? IdleDuration { get; }
public RateLimitLease Acquire(int permitCount = 1);
public ValueTask<RateLimitLease> WaitAsync(int permitCount = 1, CancellationToken cancellationToken = default);
public void Dispose();
public ValueTask DisposeAsync();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment