Handles proactive rate limiting. You should only ever create one instance of this class.
More...
|
| RateLimiter () |
| Creates a new RateLimiter instance. More...
|
|
virtual void | TrySetRules (IEnumerable< RateLimitRule > rules, string platformId=null, IEnumerable< RateLimitRule > currentCounts=null) |
| Adds application-level rate limiting rules if they have not been added already. More...
|
|
virtual void | TrySetRules (IEnumerable< RateLimitRule > rules, string methodName, string platformId, IEnumerable< RateLimitRule > currentCounts=null) |
| Adds method-level rate limiting rules if they have not been added already. More...
|
|
virtual DateTime | AddRequestOrGetDelay (string methodName, string platformId) |
| Increments the request count, or if the rate limit is reached, gets the time (in UTC) until which the client should wait before sending a request. More...
|
|
|
virtual bool | HasRules => appTrackers.Count > 0 |
| Gets whether the rate limiter has any rules set. More...
|
|
|
bool | HasRules [get] |
| Gets whether the rate limiter has any application-level rules set. More...
|
|
Handles proactive rate limiting. You should only ever create one instance of this class.
RiotNet.RateLimiter.RateLimiter |
( |
| ) |
|
|
inline |
virtual DateTime RiotNet.RateLimiter.AddRequestOrGetDelay |
( |
string |
methodName, |
|
|
string |
platformId |
|
) |
| |
|
inlinevirtual |
Increments the request count, or if the rate limit is reached, gets the time (in UTC) until which the client should wait before sending a request.
- Parameters
-
methodName | The name of the method that is executing. |
platformId | The platform ID of the default server to connect to. This should equal one of the Models.PlatformId values. |
- Returns
- The wait time, or DateTime.MinValue if no delay is required.
Implements RiotNet.IRateLimiter.
virtual void RiotNet.RateLimiter.TrySetRules |
( |
IEnumerable< RateLimitRule > |
rules, |
|
|
string |
platformId = null , |
|
|
IEnumerable< RateLimitRule > |
currentCounts = null |
|
) |
| |
|
inlinevirtual |
Adds application-level rate limiting rules if they have not been added already.
- Parameters
-
rules | The list of rules. |
platformId | The platform ID of the response that contained the rate limit definitions. The request count will automatically be incremented for this platform. |
currentCounts | The current request counts for each rule. If unspecified, 1 request for each rule will be assumed. |
Implements RiotNet.IRateLimiter.
virtual void RiotNet.RateLimiter.TrySetRules |
( |
IEnumerable< RateLimitRule > |
rules, |
|
|
string |
methodName, |
|
|
string |
platformId, |
|
|
IEnumerable< RateLimitRule > |
currentCounts = null |
|
) |
| |
|
inlinevirtual |
Adds method-level rate limiting rules if they have not been added already.
- Parameters
-
rules | The list of rules. |
methodName | The name of the method that is executing. |
platformId | The platform ID of the response that contained the rate limit definitions. The request count will automatically be incremented for this platform. |
currentCounts | The current request counts for each rule. If unspecified, 1 request for each rule will be assumed. |
Implements RiotNet.IRateLimiter.
virtual bool RiotNet.RateLimiter.HasRules => appTrackers.Count > 0 |
Gets whether the rate limiter has any rules set.
- Returns
- True if any rules have been added, otherwise false.
The documentation for this class was generated from the following file: