-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Use correct interval for request counting * Minor fixes, return correct counter value when ban period elapsed * Revert "Use correct interval for request counting" This reverts commit 7d232c7. * Revert "Artificial commit, initiate CI" This reverts commit e723dfa. * CA1822 Member 'XYZ' does not access instance data and can be marked as static * Quick code review by @raman-m * Rate Limiting feature name should match folder name * namespace `Ocelot.RateLimiting` * Extract `IRateLimitCore` interface * Remove useless `ClientRateLimitProcessor` class * Rename to `IRateLimitStorage` and dev docs * Wrap services as a feature * Review `IRateLimitCore` interface and dev docs * The middleware class prefix should match the feature name * Add some basic `RateLimitCoreTests` * Rename to `IRateLimiting` * Refactor rate limiting core * Remove redundant `SaveCounter` from the interface * Thread safe storage operations * Coalesce in return statement * Convert to file-scoped namespace * Use expression body * Unit tests for #1590 user scenario * Move test class to separate feature folder * Inherit from `Steps` * Refactoring: Follow the DRY principle * Acceptance test for #1590 user scenario * Update feature docs --------- Co-authored-by: raman-m <[email protected]>
- Loading branch information
1 parent
0b247af
commit aef3e6b
Showing
29 changed files
with
1,165 additions
and
794 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Ocelot.RateLimiting; | ||
|
||
namespace Ocelot.DependencyInjection; | ||
|
||
public static class Features | ||
{ | ||
/// <summary> | ||
/// Ocelot feature: <see href="https://github.com/ThreeMammals/Ocelot/blob/develop/docs/features/ratelimiting.rst">Rate Limiting</see>. | ||
/// </summary> | ||
/// <param name="services">The services collection to add the feature to.</param> | ||
/// <returns>The same <see cref="IServiceCollection"/> object.</returns> | ||
public static IServiceCollection AddRateLimiting(this IServiceCollection services) => services | ||
.AddSingleton<IRateLimiting, RateLimiting.RateLimiting>() | ||
.AddSingleton<IRateLimitStorage, MemoryCacheRateLimitStorage>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
src/Ocelot/RateLimit/DistributedCacheRateLimitCounterHandler.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/Ocelot/RateLimit/MemoryCacheRateLimitCounterHandler.cs
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/Ocelot/RateLimit/Middleware/RateLimitMiddlewareExtensions.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.