RateLimitInterceptor
Upgather SDK / RateLimitInterceptor
Class: RateLimitInterceptor
RequestInterceptor implementation that enforces rate limits.
Remarks
This interceptor uses the token bucket algorithm to limit the rate of requests sent to backend services, preventing them from being overwhelmed.
Implements
Constructors
new RateLimitInterceptor()
new RateLimitInterceptor(
options):RateLimitInterceptor
Creates a new rate limiting interceptor.
Parameters
options
Rate limiting configuration options
Returns
Methods
intercept()
intercept(
request):HttpRequest
Intercept the request and apply rate limiting.
Parameters
request
The HTTP request to intercept
Returns
The request if allowed to proceed
Throws
Error if rate limited and not configured to wait
Fix: Change Promise
Implementation of
interceptAsync()
interceptAsync(
request):Promise<HttpRequest>
Asynchronous version for cases where the interceptor can be explicitly called rather than through the standard interceptor chain.
Parameters
request
The HTTP request to intercept
Returns
Promise<HttpRequest>
Promise resolving to the request once rate limiting is satisfied