Skip to content

Commit 4fd4f88

Browse files
committed
chore: review pass
1 parent a0958bb commit 4fd4f88

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

services/discord-proxy/src/lib/rests.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ import type { Logger } from 'pino';
1313
* on them would grow the map without bound -- one entry per dashboard visitor, forever. `services/api`
1414
* deliberately keeps its OAuth client pointed straight at Discord for this reason (see `discordAPI.ts`);
1515
* this is the safety net for anything that slips through.
16+
*
17+
* Pooling does mean these callers share one `globalRequestsPerSecond` budget, which is left at the default 50
18+
* rather than the `Infinity` the clients use. That's deliberate and costs nothing today: Discord's 50/s global
19+
* limit is per bot token and doesn't apply to token-less routes at all, so this is a self-imposed backstop
20+
* against runaway volume rather than a mirror of anything upstream. It notably cannot delay an interaction
21+
* callback -- `@discordjs/rest` routes `/interactions/:id/:token/callback` to a `BurstHandler`, which neither
22+
* reads nor decrements the global counter (only `SequentialHandler` does), so the 3s ack window is never at
23+
* this budget's mercy. Webhook execution is the only pooled traffic it can actually throttle.
1624
*/
1725
const POOLED_KEY = '';
1826

0 commit comments

Comments
 (0)