JS heap size limit using client with client.switchUser(token) and client.destroy() #863
Unanswered
s1ncereboy
asked this question in
Q&A
Replies: 1 comment 2 replies
-
One way to at least delay this issue is by adding the The issue is that JavaScript garbage collecting doesn't seem to be correctly working, the same issue exists in the original discordJS module. If anyone has a fix, please LMK too! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone and hello aiko.
I have one issue, which I want to resolve, but I am unsure how. Hope you will give me advice.
Issue is: Every 45 min scheduler is sending messages from different clients to different channels, and every time the logic is executed, the free memory becomes less and less until 'JS Heap size error'.
I am trying to send messages via scheduler.ts from different users to different channels every 45 min:
initializeSettingsAndSendMessage() function:
I am starting a self-bot via discordClient.start(setting) method for every setting,
and perform sending messages via discordClient.sendMessagesDependsOnId(settingId).
DiscordClient class:
As you see from the code, I am using this.stop() method to destroy client. Also I am using client.switchUser() method, which login via new token and clearing cache.
After using client.switchUser() memory usage became less, but it is still not enough and I have JS heap size error.
Please, let me know what is wrong in my realization. I want to resolve issue with heap and start host my app.
Beta Was this translation helpful? Give feedback.
All reactions