Commit Graph
15 Commits
Author SHA1 Message Date
Claude 1484d5265d refactor: merge BOT_TOKEN + ADDITIONAL_BOT_TOKENS into single BOT_TOKENS env + speed audit
Deploy FileDrop / deploy (push) Failing after 19s
BOT_TOKENS env:
- Single BOT_TOKENS env var (comma-separated) replaces BOT_TOKEN + ADDITIONAL_BOT_TOKENS
- Backward compat: falls back to BOT_TOKEN + ADDITIONAL_BOT_TOKENS if BOT_TOKENS unset
- Config exposes botTokens: string[] instead of botToken + additionalBotTokens
- Updated env.ts, bot-pool.ts, docker-compose.yml, .env.example, CLAUDE.md, all tests

Speed audit (S3 -> Telegram upload flow):
- Hoisted 5 dynamic await import('../../../db/index') to top-level static imports
  in s3-controller.ts (3x) and web-api-controller.ts (2x)
  -> saves module resolution + async overhead on every upload
- Removed stale UPLOAD_CONCURRENCY env from docker-compose.yml
  (already removed from env.ts in prior refactor)

Upload flow is already concurrent:
- streamBodyToTemp() uses Bun.file(path).writer() — O(1) memory, safe for multi-GB blobs
- utils/chunked-storage.ts reads chunks serially but uploads concurrently with
  inFlight backpressure at effectiveConcurrency * 2 (= 16 with 8 bots)
- bot-pool.ts: per-bot PQueue(concurrency=1), 8 bots = 8 concurrent uploads per file,
  selectBot() picks least-loaded, 429 detection + inner+outer retry loops
- TELEGRAM_API_TIMEOUT_MS=120s — ample for 48MB chunks
- Infrastructure chunked-storage.ts (DI-based, dead code) has serial upload trap —
  noted for future cleanup
2026-07-29 15:03:02 +07:00
Claude f5d56f52d4 chore: fix lint errors — noBannedTypes, import ordering, formatting
Deploy FileDrop / deploy (push) Successful in 42s
- Replace unsafe 'Function' type in test with ITelegramService interface
- Biome auto-fix formatting and import sorting across 8 files

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-29 07:30:31 +07:00
Claude ea87397801 refactor: remove upload and web-api routes, migrate to new controller structure
Deploy FileDrop / deploy (push) Failing after 12s
- Deleted `upload.ts` and `web-api.ts` routes, consolidating logic into dedicated controllers.
- Updated import paths in tests to reflect new controller structure.
- Refactored Telegram API utilities to utilize a bot pool for improved bot management and error handling.
- Enhanced environment variable tests to ensure additional bot tokens are correctly populated.
- Adjusted S3 bucket configuration tests to align with new controller imports.
- Updated Telegram queue implementation to reflect new infrastructure organization.
2026-07-29 07:28:30 +07:00
asepharyana 52bd704d21 refactor: enhance file handling and metrics tracking; remove unused bot health tracker 2026-07-06 01:25:18 +07:00
MythEclipse 2a833d3908 feat: include bot token in file info response for Telegram API 2026-05-30 00:15:35 +07:00
MythEclipse 10c968cf01 feat: add file_hash column and related index to files table; refactor Telegram API utilities for improved file handling 2026-05-21 22:55:42 +07:00
MythEclipse 52340ee77d feat: enhance file upload handling with improved file detection, size limits, and response formatting 2026-05-21 22:31:55 +07:00
MythEclipse d58b2390ef refactor: remove concurrency limit from Telegram upload queue and enhance media group handling 2026-05-18 21:54:39 +07:00
MythEclipse 721fa3db7d feat: implement auto-retry for Telegram API requests on error 429 and update documentation 2026-05-18 21:02:38 +07:00
MythEclipseandClaude Opus 4.7 525348b1f3 fix: make forwardToStorage fully dynamic based on fileType
- Replace forceDocument boolean with fileType string in forwardToStorage
- Dynamically call matching sendPhoto, sendAudio, sendVideo, sendVoice, sendAnimation, sendSticker, or sendDocument Telegraf API method
- Correctly extract uploaded file details based on what Telegram returned
- Fixes IMAGE_PROCESS_FAILED 500 error when uploading ogg audio, video, sticker, or voice notes via HTTP
- Update upload.ts, bot.ts, and test suites to match the new dynamic signature

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 19:52:46 +07:00
MythEclipse ed7f607ee4 style: sort imports in telegram test to satisfy Biome check 2026-05-18 08:55:22 +07:00
MythEclipse ed88069e60 fix: assert sendDocument with config.storageChatId to match dynamic mock env in CI 2026-05-18 08:54:24 +07:00
MythEclipse 91986d1d51 fix: upload binary files to Telegram with source payload 2026-05-18 08:18:55 +07:00
MythEclipse cf79a1f195 style: format and lint codebase using Biome v2 2026-05-18 07:29:01 +07:00
MythEclipse 3f4e697733 feat: migrate entire codebase to TypeScript 2026-05-18 07:27:06 +07:00