RateLimiter icon indicating copy to clipboard operation
RateLimiter copied to clipboard

Check if time limit is satisfied without waiting for it

Open alexb5dh opened this issue 1 year ago • 0 comments

Is it possible to check that TimeLimiter instance is available (await will return immediately) without actually awaiting it?

Use case: non-blocking rate limiting. A method is being called in a loop and if execution is attempted outside of allowed time constrains, method should just return immediately without blocking the caller.

TimeLimiter.GetAwaiter().IsCompleted is programmed to always return false, so is not an option.

alexb5dh avatar Mar 29 '23 07:03 alexb5dh