Skip to content

Request Priorities

Ollie Jennings edited this page Sep 11, 2020 · 2 revisions

Motivation

Generally all requests to the Riot API are equal, and thus are treated as such. When you make several requests, they are queued and executed in the order you made them.

However there are cases where you have some requests that are critical to your application, and should have higher priority that others. For example, if you have an application that uses the tournament endpoints, it would make sense for requests that create tournament codes to have a higher priority over requests that simply lookup summoners by summonerNames.

With this feature, you can also give requests a unique ID, this will be benifical for debuging, as we will use this ID in the debug messages.

Usage

interface JobOptions {
  id: string;
  priority: 2; // default is 5
}

const limiter = new RiotRateLimiter();
const jobOpts = { id: 'some id', priority: 4 }
const resp = await limiter.execute(reqOptions, jobOpts);

The value of priority ranges from 0 - 9, where 0 is the highest priority and 9 is the lowest. So a job with priority 4 will run before a job with priority 5.

Clone this wiki locally