Class RateLimitedHttpMessageHandler
- Namespace
- Fusillade
- Assembly
- Fusillade.dll
A http handler which will limit the rate at which we can read.
- Inheritance
-
Rate
Limited Http Message Handler
- Implements
- Inherited Members
Remarks
Initializes a new instance of the Rate
Constructors
RateLimitedHttpMessageHandler(HttpMessageHandler, Priority, int, long?, OperationQueue?, Func<HttpRequestMessage, HttpResponseMessage, string, CancellationToken, Task>?)
A http handler which will limit the rate at which we can read.
public RateLimitedHttpMessageHandler(HttpMessageHandler handler, Priority basePriority, int priority = 0, long? maxBytesToRead = null, OperationQueue? opQueue = null, Func<HttpRequestMessage, HttpResponseMessage, string, CancellationToken, Task>? cacheResultFunc = null)
Parameters
handler
HttpMessage Handler The handler we are wrapping.
basePriority
PriorityThe base priority of the request.
priority
intThe priority of the request.
maxBytesToRead
long?The maximum number of bytes we can read.
opQueue
OperationQueue The operation queue on which to run the operation.
cacheResultFunc
Func<HttpRequest , HttpMessage Response , string, CancellationMessage Token , Task>A method that is called if we need to get cached results.
Remarks
Initializes a new instance of the Rate
Methods
ResetLimit(long?)
Resets the total limit of bytes to read. This is usually called when the app resumes from suspend, to indicate that we should fetch another set of data.
Parameters
maxBytesToRead
long?The maximum number of bytes to read.
SendAsync(HttpRequestMessage, CancellationToken)
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
request
HttpRequest Message cancellationToken
CancellationToken
Returns
UniqueKeyForRequest(HttpRequestMessage)
Generates a unique key for a Http
Parameters
request
HttpRequest Message The request to generate a unique key for.
Returns
- string
The unique key.