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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user