Documentation Index
Fetch the complete documentation index at: https://mintlify.com/renja-g/RiftRelay/llms.txt
Use this file to discover all available pages before exploring further.
What are Priority Requests?
By default, RiftRelay spreads requests evenly across the rate limit window to avoid bursts. Priority requests allow you to bypass this pacing delay for time-sensitive operations while still respecting rate limits.Priority requests skip the pacing delay but still consume rate limit capacity. They do not bypass Riot’s rate limits.
When to Use Priority Requests
Use priority requests for:Real-time Data
Live game data or match updates that need immediate processing
User-facing Requests
API calls triggered directly by user actions where latency matters
Critical Operations
Time-sensitive operations that cannot wait in the queue
Low-volume Priority
Occasional high-priority requests mixed with bulk processing
How to Send Priority Requests
Add theX-Priority: high header to your request:
How Priority Works
From the source code ininternal/limiter/limiter.go:
limiter.go
Priority Detection
RiftRelay detects the
X-Priority: high header and marks the request as high priority.Bypass Pacing
The
bypassPacing flag skips the even distribution delay that normal requests experience.Priority Levels
RiftRelay supports two priority levels defined ininternal/limiter/types.go:
types.go
- PriorityNormal - Default priority with pacing delay
- PriorityHigh - Bypasses pacing delay
Comparison: Normal vs Priority
Normal Request
- Enters the normal priority queue
- Waits for pacing delay to spread requests evenly
- Sent when the next scheduled slot is available
- Lower latency impact on other requests
Priority Request
- Enters the high priority queue
- Bypasses pacing delay
- Sent as soon as rate limit capacity allows
- Minimal latency for this specific request
Both types still respect the same rate limits from Riot’s API. Priority affects queue position and pacing, not rate limit consumption.
Queue Behavior
Frominternal/limiter/limiter.go, RiftRelay maintains separate queues:
limiter.go
Best Practices
Use Sparingly
Use Sparingly
Reserve priority requests for truly time-sensitive operations. If 90%+ of your requests are priority, you’re bypassing the benefits of request pacing.
Monitor Queue Depth
Monitor Queue Depth
Enable metrics to monitor queue depth by priority:If priority queues are consistently full, you may need to increase capacity or reduce priority usage.
.env
Combine with Multiple Tokens
Combine with Multiple Tokens
Using multiple tokens increases total throughput, giving priority requests more capacity to work with.
Handle Rejection Gracefully
Handle Rejection Gracefully
Priority requests can still be rejected if rate limits are exhausted. Always handle 429 responses and respect
Retry-After headers:Rate Limiting Behavior
From the README, here’s how RiftRelay handles rate limits:When requests come in, RiftRelay figures out which rate limit bucket they belong to and adds them to a queue. A scheduler picks requests from the queue and sends them when there’s room in the rate limit window. Instead of sending all requests at once when the limit resets, RiftRelay spreads them out evenly over time to avoid sudden bursts.Priority requests modify this behavior:
- Normal requests: Spread evenly across the rate limit window
- Priority requests: Sent as soon as capacity allows, no artificial pacing delay
- Both types: Respect the same rate limit capacity from Riot’s API
Example Scenario
Imagine you’re building an app that:- Processes bulk match history analysis (background job)
- Displays live game data when users click a button (user-facing)
Example Implementation
Limitations
Next Steps
Multiple Tokens
Increase throughput with multiple API tokens
Configuration
Tune queue capacity and timeouts