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

Dzmitryi Basau #281

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Dzmitryi Basau #281

wants to merge 3 commits into from

Conversation

BasovDmitry
Copy link

Rate-limiting implementation.

Dzmitryi Basau added 3 commits January 31, 2025 16:31
Updated RateLimiter.Tests.csproj to include Moq for mocking in tests.
Significantly refactored RateLimiterTest.cs by replacing the single
RateLimiterTest class with multiple test classes: FixedWindowRuleTests,
SlidingWindowRuleTests, RegionalRuleTests, RateLimiterTests, and
ConcurrencyTests. Each class contains multiple test methods.

Updated RateLimiter.csproj to include Microsoft.Extensions.Logging for
logging capabilities.

Added RateLimiter.cs with the following:
- IRateLimitRule interface with IsAllowed and Cleanup methods.
- FixedWindowRule class implementing IRateLimitRule using a fixed window
  algorithm.
- SlidingWindowRule class implementing IRateLimitRule using a sliding
  window algorithm.
- RegionalRule class implementing IRateLimitRule applying rules based on
  client's region.
- RateLimiter class managing multiple rate limiting rules and logging
  blocked requests.
Refactored the `IRateLimitRule`, `FixedWindowRule`, `SlidingWindowRule`, and `RegionalRule` classes into their own files within the `RateLimiter.Rules` namespace to improve code organization and modularity. Updated `RateLimiterTest.cs` and `RateLimiter.cs` to reflect these changes. Added additional region checks for "ASIA" and a default "GLOBAL" region in the `RegionalRule` class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant