mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
refactor: remove timer utilities from Client (#6113)
This commit is contained in:
@@ -159,7 +159,10 @@ class Client extends BaseClient {
|
||||
this.readyAt = null;
|
||||
|
||||
if (this.options.messageSweepInterval > 0) {
|
||||
this.setInterval(this.sweepMessages.bind(this), this.options.messageSweepInterval * 1000);
|
||||
this.sweepMessageInterval = setInterval(
|
||||
this.sweepMessages.bind(this),
|
||||
this.options.messageSweepInterval * 1000,
|
||||
).unref();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +245,8 @@ class Client extends BaseClient {
|
||||
*/
|
||||
destroy() {
|
||||
super.destroy();
|
||||
if (this.sweepMessageInterval) clearInterval(this.sweepMessageInterval);
|
||||
|
||||
this.ws.destroy();
|
||||
this.token = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user