mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
oops
This commit is contained in:
1 parent
e11fca151c
commit
9fb2e7255e
2 files changed
+23
-1
No files matched your search
@@ -1026,7 +1026,20 @@ const isIgnorableWsCrash = (err) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether an error is the benign LiveKit "AudioSource is closed" race.
|
||||||
|
* Happens when a track is skipped/stopped while @fluxerjs/voice's internal
|
||||||
|
* WebM demuxer still has queued frames to push into the just-closed audio
|
||||||
|
* source. Harmless by itself — but if it ever surfaces as a synchronous
|
||||||
|
* uncaughtException it must NOT take the whole bot down.
|
||||||
|
* @param {Error} err - The error to check.
|
||||||
|
* @returns {boolean} True if the error is the audio stop-race.
|
||||||
|
*/
|
||||||
|
const isBenignAudioStopRace = (err) =>
|
||||||
|
String(err?.message ?? err ?? "").includes("AudioSource is closed");
|
||||||
|
|
||||||
let _lastWsCrashLog = 0;
|
let _lastWsCrashLog = 0;
|
||||||
|
let _lastAudioRaceLog = 0;
|
||||||
const WS_CRASH_LOG_COOLDOWN = 30_000;
|
const WS_CRASH_LOG_COOLDOWN = 30_000;
|
||||||
|
|
||||||
process.on("unhandledRejection", (reason, p) => {
|
process.on("unhandledRejection", (reason, p) => {
|
||||||
@@ -1043,12 +1056,21 @@ process.on("uncaughtException", (err, origin) => {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isBenignAudioStopRace(err)) {
|
||||||
|
const now = Date.now();
|
||||||
|
if (now - _lastAudioRaceLog > WS_CRASH_LOG_COOLDOWN) {
|
||||||
|
_lastAudioRaceLog = now;
|
||||||
|
logger.warn("[Error_Handling] Suppressed benign audio stop-race (AudioSource is closed) — track was skipped/stopped mid-frame.");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
logger.error("[Error_Handling] Uncaught Exception/Catch");
|
logger.error("[Error_Handling] Uncaught Exception/Catch");
|
||||||
logger.error("Error:", err, origin);
|
logger.error("Error:", err, origin);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
process.on("uncaughtExceptionMonitor", (err, origin) => {
|
process.on("uncaughtExceptionMonitor", (err, origin) => {
|
||||||
if (isIgnorableWsCrash(err)) return;
|
if (isIgnorableWsCrash(err)) return;
|
||||||
|
if (isBenignAudioStopRace(err)) return;
|
||||||
logger.error("[Error_Handling] Uncaught Exception/Catch (MONITOR)");
|
logger.error("[Error_Handling] Uncaught Exception/Catch (MONITOR)");
|
||||||
logger.error("Error:", err, origin);
|
logger.error("Error:", err, origin);
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
"opusscript": "^0.0.8",
|
"opusscript": "^0.0.8",
|
||||||
"prism-media": "^1.3.5",
|
"prism-media": "^1.3.5",
|
||||||
"redis": "^5.12.1"
|
"redis": "^5.12.1"
|
||||||
},w
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node --inspect index.mjs --trace-warnings",
|
"dev": "node --inspect index.mjs --trace-warnings",
|
||||||
"start": "node index.mjs",
|
"start": "node index.mjs",
|
||||||
|
|||||||
Reference in new issue
Block a user