Please describe the problem you are having in as much detail as possible:
After calling client.destroy(), active requests remain and the script exits only after two minutes.
Include a reproducible code sample here, if possible:
const Discord = require('discord.js');
const client = new Discord.Client();
client.login('token').then(success);
function success() {
console.log('Signing in to account');
console.time('Event loop cleared');
client.destroy();
}
process.on('exit', () => {
console.timeEnd('Event loop cleared');
});
Further details:
Priority this issue should have – please be realistic and elaborate if possible: low
[ ] I found this issue while running code on a __user account__
client.destroy() only destroys the client, logging out the bot user, terminating the WebSocket connection and clearing all timeouts set on the client. It will not terminate your process, like process.exit() does.
@devdutchy client.destroy is supposed to clean up the client so the process can cleanly exit by itself
this seems to be related to #2361
I cherry-picked a fix with https://github.com/discordjs/discord.js/commit/af75e43900e01fae31c65a2871dd9d4a3c519c0f into the 11.3-dev branch for the 11.3.1 release.
Most helpful comment
@devdutchy client.destroy is supposed to clean up the client so the process can cleanly exit by itself
this seems to be related to #2361