fix(gateway): voice module critical bugs

- shutdown ordering: DB pool closed AFTER voice disconnect (was before)
- muxer: amix (mix) -> concat (sequential) filter for OGG segments
- upload retries: 0->3 with proper backoff 1-10s
- teleUpload retry backoff: minTimeout 0->1000, maxTimeout 0->10000
- mediaSource: 64KB buffer bound on readFirstTwoLines, 1MB on extractMediaInfo
- ffmpegProcess: pipe stderr to structured logger instead of inherit

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-13 14:35:35 +07:00
co-authored by Claude
parent e6e34281ff
commit 29d4cb87b6
6 changed files with 40 additions and 15 deletions
+7 -3
View File
@@ -36,19 +36,23 @@ export function createGracefulShutdown(options: GracefulShutdownOptions) {
try {
options.stopMetricsServer?.();
stopMuxerWorker();
options.logger.info("Closing database...");
await options.closeDatabase();
options.logger.info("Database closed");
// 1. Voice disconnect (may write final DB records)
options.logger.info("Stopping voice connection...");
await options.voiceController.disconnect();
// 2. Close Redis/pubsub after voice is done
options.logger.info("Closing event broadcaster...");
await options.eventBroadcaster.close();
options.logger.info("Closing command handler...");
await options.commandHandler.close();
// 3. DB pool LAST voice disconnect may finalize recordings
options.logger.info("Closing database...");
await options.closeDatabase();
options.logger.info("Database closed");
options.logger.info("Destroying Discord client...");
try {
options.client.destroy();