fix: CI biome errors + enhanced GUILD_CREATE/READY voice_states diagnostic
- live-speaker.ts: unused var [id] in clearAllSpeakers → [_] - migrate.ts: useTemplate string concat → template literal - streamWatchReceiver: remove unused watchKey param from closeCurrentSegment - videoRecorder: log all raw WS event types + READY sessions.voice + broadcaster_user_ids
This commit is contained in:
@@ -99,7 +99,7 @@ export function getSpeakingSpeakers(): LiveSpeaker[] {
|
||||
* snapshot doesn't carry ghost speakers.
|
||||
*/
|
||||
export function clearAllSpeakers(): void {
|
||||
for (const [id, s] of speakers) {
|
||||
for (const [, s] of speakers) {
|
||||
s.speaking = false;
|
||||
}
|
||||
purgeStale();
|
||||
|
||||
@@ -122,7 +122,7 @@ const _silenceInterval = setInterval(() => {
|
||||
);
|
||||
|
||||
// Fire-and-forget: close + finalize the segment.
|
||||
void closeCurrentSegment(watch, watchKey);
|
||||
void closeCurrentSegment(watch);
|
||||
}
|
||||
}, 2_000);
|
||||
// Prevent the interval from keeping the process alive.
|
||||
@@ -655,10 +655,7 @@ async function openOutput(
|
||||
* ready for a new segment (silence ended → packets resume).
|
||||
* Mirrors voice recording's finalizeSegment + uploadRecordingSegment flow.
|
||||
*/
|
||||
async function closeCurrentSegment(
|
||||
watch: WatchState,
|
||||
watchKey: string,
|
||||
): Promise<void> {
|
||||
async function closeCurrentSegment(watch: WatchState): Promise<void> {
|
||||
if (!watch.out || watch.out.destroyed || watch.closing) return;
|
||||
// Mark closing FIRST (synchronously) so the UDP handler stops writing.
|
||||
watch.closing = true;
|
||||
@@ -835,7 +832,7 @@ function closeWatch(watch: WatchState): void {
|
||||
}
|
||||
// Finalize any open segment (mux to MP4 + DB + upload).
|
||||
if (watch.out && !watch.out.destroyed) {
|
||||
void closeCurrentSegment(watch, `${watch.guildId}:${watch.uid}`);
|
||||
void closeCurrentSegment(watch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,12 @@ export function setVideoRecorderClient(client: Client | undefined) {
|
||||
: -1,
|
||||
broadcasterUserIds: dAny.broadcaster_user_ids,
|
||||
sessionVoice: Array.isArray(dAny.sessions)
|
||||
? (dAny.sessions as Array<{ voice?: unknown; session_id?: unknown }>)
|
||||
? (
|
||||
dAny.sessions as Array<{
|
||||
voice?: unknown;
|
||||
session_id?: unknown;
|
||||
}>
|
||||
)
|
||||
.map((s) => s.voice)
|
||||
.filter(Boolean)
|
||||
.slice(0, 5)
|
||||
|
||||
@@ -194,8 +194,7 @@ async function seedDrizzleHistory(client: PoolClient): Promise<void> {
|
||||
// recorded). Seed up to the last journal `when` so Drizzle skips them
|
||||
// instead of re-running already-applied DDL and crashing. This is the
|
||||
// recovery that broke the gateway's infinite-restart loop.
|
||||
const journalTag =
|
||||
(await getFirstMigrationTag()) + `@${lastMigrationWhen}-reconciled`;
|
||||
const journalTag = `${await getFirstMigrationTag()}@${lastMigrationWhen}-reconciled`;
|
||||
await client.query(
|
||||
`INSERT INTO "__drizzle_migrations" (hash, created_at) VALUES ($1, $2)`,
|
||||
[journalTag, lastMigrationWhen],
|
||||
|
||||
Reference in New Issue
Block a user