Merge remote-tracking branch 'refs/remotes/origin/main'

This commit is contained in:
ShadowLp174 committed 2026-05-16 14:12:24 +00:00
commit 16e4f853a6
1 file changed
+29 -1
+29 -1
View File
@@ -2,7 +2,7 @@ import { Events, GatewayOpcodes } from "@fluxerjs/core";
import { getVoiceManager } from "@fluxerjs/voice";
import { logger } from "./constants/Logger.mjs";
import { ServerSettings } from "./Settings.mjs";
import { get247ChannelMode } from "./constants/Helpers247.mjs";
import { get247ChannelMode, remove247ChannelMode } from "./constants/Helpers247.mjs";
import mysql from "mysql2";
/**
@@ -1427,6 +1427,34 @@ export class GatewayHandler {
`[BootRecovery] Failed to rejoin channel ${channelId} (mode: ${mode}): ${errMsg}` +
(bootRetries > 1 ? ` (after ${bootRetries} attempts)` : '')
);
// Auto-cleanup: if all retries exhausted due to track publication
// failure, remove the channel from 24/7 so it doesn't block boot
// recovery on every restart.
if (isTrackTimeout && bootRetries >= BOOT_MAX_RETRIES) {
try {
const set = remix.settingsMgr.getServer(guildId);
if (set) {
const raw = set.get("stay_247");
const channels = new Set(
(Array.isArray(raw) ? raw : [raw])
.filter(id => id && id !== "none" && String(id).replace(/\D/g, "") !== channelId)
);
set.set("stay_247", channels.size > 0 ? [...channels] : "none");
remove247ChannelMode(set, channelId, channels);
logger.warn(
`[BootRecovery] Auto-removed channel ${channelId} from 24/7 ` +
`in guild ${guildId} after persistent track publication failure`
);
}
} catch (cleanupErr) {
logger.error(
`[BootRecovery] Failed to auto-remove channel ${channelId} from 24/7:`,
cleanupErr?.message ?? cleanupErr
);
}
}
break; // non-retryable error or max retries exhausted
}
}