fix(voice, music): resolve thundering herd rejoins, playback drop recovery, and telemetry warnings

- Stagger simultaneous 24/7 channel rejoins (+2.5s per pending channel) and defer rejoins when the gateway is not connected
- Add in-place voice reconnection recovery during track playback to prevent burning through queue songs on transient LiveKit disconnects
- Fix audio publication race on seek by removing redundant bridge stop and increasing unpublish timeout to 2,500ms
- Eliminate duplicate voice reconnect races in Player disconnect handler for 24/7 channels
- De-escalate routine background reconnect logs from logger.warn/error to logger.voice247/player to stop spurious Discord warning embeds
- Sanitize upstream Cloudflare/Fluxer 503 HTML error pages into single-line messages in ErrorChannel
This commit is contained in:
NoLogicAlan committed 2026-11-06 01:46:27 +03:00
1 parent 8b99bd01dc
commit cc07c35f2a
6 files changed
+53 -13

No files matched your search

+11 -3
View File
@@ -607,9 +607,17 @@ class Player extends EventEmitter {
this._voiceConn = null;
this.connection = null;
const cId = cleanId(this._channelId ?? this._home247Channel ?? "");
if (cId && (this._get247Mode() === "on" || this.queue?.getCurrent() || !(this.queue?.isEmpty?.() ?? true))) {
logger.player(`[Player] Voice disconnected with active session — scheduling reconnect to channel ${cId}`);
this.join(cId).catch(err => logger.warn(`[Player] Voice reconnect after disconnect failed: ${err?.message}`));
const is247 = this._get247Mode() === "on";
if (is247) {
/* 24/7 channels are managed centrally by GatewayHandler and schedule247Rejoin to prevent race conditions */
return;
}
if (cId && (this.queue?.getCurrent() || !(this.queue?.isEmpty?.() ?? true))) {
logger.player(`[Player] Voice disconnected with active session — scheduling reconnect to channel ${cId} in 2.5s`);
setTimeout(() => {
if (this.leaving || this._destroyed || this._voiceConn) return;
this.join(cId).catch(err => logger.player(`[Player] Voice reconnect after disconnect failed: ${err?.message}`));
}, 2_500).unref?.();
}
});
}