fix(voice): prevent 24/7 rejoin spam when bot is not in guild or voice times out

- Check guild membership before BootRecovery and Watchdog sweeps; keep settings intact if bot is not in server
- Wire up RejoinBackoff to apply exponential cooldown when voice joins time out
- Stop redundant retry loops and deduplicate join failure logs
This commit is contained in:
NoLogicAlan committed 2026-10-21 03:38:12 +03:00
1 parent 355f6b1129
commit f2bfff59b5
5 files changed
+61 -8

No files matched your search

+14 -2
View File
@@ -57,8 +57,7 @@ const RejoinManager = {
}
logger.warn(
`[${context}] Failed to rejoin channel ${channelId} (attempt ${attempt}/${maxRetries}): ${errMsg}` +
(attempt > 1 ? ` (after ${attempt} attempts)` : '')
`[${context}] Failed to rejoin channel ${channelId}: ${errMsg} — keeping 24/7 setting intact.`
);
return null;
}
@@ -79,6 +78,17 @@ const RejoinManager = {
const cleanGuildId = cleanId(guildId);
const cleanChannelId = cleanId(channelId);
const guild = remix.client?.guilds?.get?.(cleanGuildId);
if (!guild) {
logger.voice247(`[Rejoin] Bot is not currently in guild ${cleanGuildId} — skipping ${cleanChannelId} (setting kept intact).`);
return;
}
if (this.rejoinBackoff?.remainingMs?.(cleanChannelId) > 0) {
logger.voice247(`[Rejoin] Channel ${cleanChannelId} in backoff cooldown — skipping.`);
return;
}
if (this._rejoinInProgress.has(cleanChannelId)) {
logger.voice247(`[Rejoin] Channel ${cleanChannelId} rejoin already in progress — skipping.`);
return;
@@ -131,6 +141,7 @@ const RejoinManager = {
const player = await this._attemptRejoin(cleanChannelId, cleanGuildId, maxRetries, 5_000, "Rejoin");
if (player) {
this._rejoinAttempts.delete(cleanChannelId);
this.rejoinBackoff?.recordSuccess?.(cleanChannelId);
try {
await remix.restorePlayerStateForChannel?.(cleanGuildId, cleanChannelId, player);
} catch (err) {
@@ -138,6 +149,7 @@ const RejoinManager = {
}
} else {
this._rejoinAttempts.delete(cleanChannelId);
this.rejoinBackoff?.recordFailure?.(cleanChannelId);
}
return player;
} finally {