From cb530612569f9657c75ac9177069fd521fa6e423 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Mon, 4 Oct 2021 19:27:00 +0300 Subject: [PATCH] Limit cache size --- backend/src/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index f360be4b..142e3a07 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -1,4 +1,4 @@ -import { Client, Constants, Intents, TextChannel, ThreadChannel } from "discord.js"; +import { Client, Constants, Intents, Options, TextChannel, ThreadChannel } from "discord.js"; import { Knub, PluginError } from "knub"; import { PluginLoadError } from "knub/dist/plugins/PluginLoadError"; // Always use UTC internally @@ -176,6 +176,14 @@ connect().then(async () => { const client = new Client({ partials: ["USER", "CHANNEL", "GUILD_MEMBER", "MESSAGE", "REACTION"], + makeCache: Options.cacheWithLimits({ + ...Options.defaultMakeCacheSettings, + MessageManager: 0, + GuildMemberManager: 5000, + BaseGuildEmojiManager: 1000, + GuildInviteManager: 0, + }), + restGlobalRateLimit: 50, // restTimeOffset: 1000,