Discord.js: Holding the event loop after the client is destroyed

Created on 1 Mar 2018  Â·  3Comments  Â·  Source: discordjs/discord.js

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:

  • discord.js version: 11.3.0
  • node.js version: 6.11.2
  • Operating system: Windows
  • Priority this issue should have – please be realistic and elaborate if possible: low

  • [ ] I found this issue while running code on a __user account__

  • [x] I have also tested the issue on latest master, commit hash: (2a9fdef9e541e47196982055595e1987bc1de74e)
fixed on master bug

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

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LLamaFTL picture LLamaFTL  Â·  3Comments

tiritto picture tiritto  Â·  3Comments

Blumlaut picture Blumlaut  Â·  3Comments

Alipoodle picture Alipoodle  Â·  3Comments

PassTheMayo picture PassTheMayo  Â·  3Comments