From 95c3efbdb448cb4d0735a86b22302cc681069f88 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Thu, 28 Oct 2021 17:19:07 +0300 Subject: [PATCH] debug: add global rate limit logging --- backend/src/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/src/index.ts b/backend/src/index.ts index 2d8bfc7a..bbb4770b 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -370,6 +370,15 @@ connect().then(async () => { enableProfiling(); } + let lowestGlobalRemaining = Infinity; + setInterval(() => { + lowestGlobalRemaining = Math.min(lowestGlobalRemaining, (client as any).rest.globalRemaining); + }, 100); + setInterval(() => { + console.log("Lowest global remaining in the past 5 seconds:", lowestGlobalRemaining); + lowestGlobalRemaining = Infinity; + }, 5000); + bot.initialize(); logger.info("Bot Initialized"); logger.info("Logging in...");