fix(voice): restore voice features and apply critical optimizations
Voice Feature Restoration: - Implemented full Redis pub/sub pipeline for real-time voice data - Added VOICE_PCM and VOICE_ACTIVE_USER Redis channels - Implemented EventBroadcaster.voicePcmData() and voiceActiveUser() methods - Extended backend redis-bridge to subscribe to voice channels - Updated backend WebSocket server for binary PCM broadcast - Replaced globalThis PcmBroadcaster pattern with proper EventBroadcaster DI - Fixed root cause: PcmBroadcaster functions were never initialized Bug Fixes: - Fixed prism-media version conflict (2.0.0-alpha.0 → 1.3.5) - Fixed type inconsistency in commandHandler.ts (AudioPlayerStatus → string) Critical Optimizations: - P1.1: Fixed unbounded memory growth in aiAnalyzer (added LRU caching, max 10K entries) - P1.2: Converted sync file I/O to async in audio hot paths (recorder, sessionRecording) - P1.3: Replaced process.exit(1) with proper error handling (bootstrap, aiAnalysisWorker) Code Quality: - Removed unused logger field in EventBroadcaster - Replaced console.* with structured logger.* calls (player, decoder) - Fixed typos and removed commented debug code - Added DatabaseError class for better error handling Files Modified: 18 (discord-gateway: 14, backend: 3, root: 1) Architecture: Discord → EventBroadcaster → Redis → Backend WebSocket → Frontend Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
2643a3c278
commit
13a75a5101
@@ -11,6 +11,7 @@
|
||||
|
||||
type BroadcastFn = (data: unknown) => void;
|
||||
type BroadcastRawFn = (type: string, data: unknown) => void;
|
||||
type BroadcastBinaryFn = (data: Buffer) => void;
|
||||
|
||||
declare global {
|
||||
// biome-ignore lint/suspicious/noAssignInExpressions: intentional global broadcast registry
|
||||
@@ -21,12 +22,14 @@ declare global {
|
||||
messageDeleted: BroadcastFn;
|
||||
attachmentUploaded: BroadcastFn;
|
||||
raw: BroadcastRawFn;
|
||||
binary: BroadcastBinaryFn;
|
||||
}
|
||||
| undefined;
|
||||
}
|
||||
|
||||
const noop: BroadcastFn = () => {};
|
||||
const noopRaw: BroadcastRawFn = () => {};
|
||||
const noopBinary: BroadcastBinaryFn = () => {};
|
||||
|
||||
export const broadcastMessageCreated: BroadcastFn = (data) =>
|
||||
(globalThis.__broadcastFns?.messageCreated ?? noop)(data);
|
||||
@@ -42,3 +45,6 @@ export const broadcastAttachmentUploaded: BroadcastFn = (data) =>
|
||||
|
||||
export const broadcastRaw: BroadcastRawFn = (type, data) =>
|
||||
(globalThis.__broadcastFns?.raw ?? noopRaw)(type, data);
|
||||
|
||||
export const broadcastBinary: BroadcastBinaryFn = (data) =>
|
||||
(globalThis.__broadcastFns?.binary ?? noopBinary)(data);
|
||||
|
||||
Reference in New Issue
Block a user