fix(core): resolve wrong file_id error and zip stream memory leaks

- Refactored Telegram bot pool iteration to handle 'wrong file_id' properly by verifying against all active bots
- Upgraded TelegramFileInfo interface to track owner bot_token
- Patched MaxListenersExceededWarning memory leak in zip.ts stream writes with events.once and async iteration
This commit is contained in:
MythEclipse
2026-06-20 22:24:23 +07:00
parent 50176e5764
commit 20b622c4c2
3 changed files with 43 additions and 48 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ type RequestWithParams = Request & {
const getTelegramFileInfo = async (telegramFileId: string, public_id: string) => {
const cacheKey = `file_info_${telegramFileId}`;
let fileInfo = fileInfoCache.get(cacheKey);
let fileInfo = fileInfoCache.get(cacheKey) as any;
if (!fileInfo) {
fileInfo = await getFileInfo(telegramFileId);
@@ -26,7 +26,7 @@ const getTelegramFileInfo = async (telegramFileId: string, public_id: string) =>
logger.debug('File info from cache', { public_id, cacheKey });
}
return fileInfo;
return fileInfo as { file_size: number; mime_type: string; file_path: string; bot_token: string };
};
const buildTelegramFileUrl = (filePath: string, botToken: string): string =>