Caching
Idk what do with caching anymore, I tried sweeping and tbh it doesnt work. I removed the call of messagecontent intents when initializing the bot and it significantly reduced memory usage from 400mb gradually growing over 12h to 190mb graduall growing over 12h both starting at 80mb of ram. So can i disable caching all together? Would that be inefficient. what else can i do here. sweeping is tbh dead. and no i dont have any memory leaks in my code. Or is there a way to sweep all cached stuff by discordjs instead of pointing out every thing to sweep? here is my code rn:
5 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPnode 18, discordjs 14.14.1
can i disable caching? if yes what are the consequences
my bot needs to read/create webhooks and guilds isnt that needed for everything including webhooks
messagecontent intent was added for a test command i dont really need it but the issue here is the ram gradually increasing for no reason
im guessing the guilds intent is caching many guilds stuff? but there is no option to sweep guilds idk im lost
what does the guild intent even cache
so webhooks
alright then im lost
that makes sense i do send a lot of it
shouldnt the messages sweep tho take care of it?
alright will test that and come back after 12 to 14h
ok sorry to bother but how do i exactly do that i cant seem to find the documentation ofit
:guide: Miscellaneous: Cache customization - Limiting caches
When creating a new Clientopen in new window, you can limit the size of caches, which are specific to certain managers, using the makeCache option. Generally speaking, almost all your customizations can be done via the helper functions from the Optionsopen in new window module.
read more
alright
here is my code ill deploy it and monitor ram usage
yeah i guessed so
fixed
throwing something out there i can already see a big difference it starts now at 70mb instead of 80. Idk how that worked out but ill update this thread after 12h
all makeCache rules
on my bot i only use
so i shouldnt worry about disabling all cache right? therre isnt any other functionalities that require it? nothing else that uses the cache Update: even with: memory is still increasing now the code is nothing except bot.on('ready') and thats it, it does nothing it's even worse with these, without limiting everything it uses around 15mb less memory but still increases overtime im so lost here's the entire code: it's using around 20mb more on startup too by limiting everything, So idk? what went wrong now it uses less memory with just but it still increases overtime.
so i shouldnt worry about disabling all cache right? therre isnt any other functionalities that require it? nothing else that uses the cache Update: even with: memory is still increasing now the code is nothing except bot.on('ready') and thats it, it does nothing it's even worse with these, without limiting everything it uses around 15mb less memory but still increases overtime im so lost here's the entire code: it's using around 20mb more on startup too by limiting everything, So idk? what went wrong now it uses less memory with just but it still increases overtime.
on a sparkedhost server
sorry this is my mobile account i cant currently reach my pc to reply with the other account
i'm not home
i own a lot of big servers and big bots and i split ownerships between accounts
in case one gets compromised
it's probably then just normal but i guess it reduced the ram significantly which is good. Thanks for the help i'll mark the ticket as solved
when i get home...