refactor(*): us timer.unref()

This commit is contained in:
DevAndromeda 2021-08-08 00:20:51 +05:45
parent 9671d60ac6
commit e66ef442e2
No known key found for this signature in database
GPG key ID: FA40E3EC5CB6DCD6
3 changed files with 3 additions and 3 deletions

View file

@ -117,7 +117,7 @@ class Player extends EventEmitter<PlayerEvents> {
if (!this.queues.has(queue.guild.id)) return; if (!this.queues.has(queue.guild.id)) return;
queue.destroy(); queue.destroy();
this.emit("channelEmpty", queue); this.emit("channelEmpty", queue);
}, queue.options.leaveOnEmptyCooldown || 0); }, queue.options.leaveOnEmptyCooldown || 0).unref();
queue._cooldownsTimeout.set(`empty_${oldState.guild.id}`, timeout); queue._cooldownsTimeout.set(`empty_${oldState.guild.id}`, timeout);
} }
} }

View file

@ -657,7 +657,7 @@ class Queue<T = unknown> {
this.connection.playStream(resource).then(() => { this.connection.playStream(resource).then(() => {
this.setVolume(this.options.initialVolume); this.setVolume(this.options.initialVolume);
}); });
}, this.#getBufferingTimeout()); }, this.#getBufferingTimeout()).unref();
} }
/** /**

View file

@ -91,7 +91,7 @@ class Util {
* @returns {Promise<unknown>} * @returns {Promise<unknown>}
*/ */
static wait(time: number) { static wait(time: number) {
return new Promise((r) => setTimeout(r, time)); return new Promise((r) => setTimeout(r, time).unref());
} }
static noop() {} // eslint-disable-line @typescript-eslint/no-empty-function static noop() {} // eslint-disable-line @typescript-eslint/no-empty-function