Skip to content

Concurrency

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

Motivation

For small projects etc, it make sense to only have 1 request being sent at a time, usually we are not concerned with a long running request preventing others from being sent.

In larger / user facing projects, performance is important, and we not be waiting for long running requests if we have the capacity send other requests within our rate-limits for our API Token. By default the concurrency limit is 1, this is for safety reasons, however you can override this via the constructor.

Note, that if you set the concurrency value too high, other features like request priorities will cease to work, as requests will jsut be executed immediately.

Usage

const limiter = new RiotRateLimiter({ concurrency: 4 });