refactor: remove uploadConcurrency from config

Effective concurrency derived from bot pool size. Chunked-storage
backpressure now uses botPool.getEffectiveConcurrency().

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude
2026-07-29 13:30:49 +07:00
parent adbf9b5efa
commit d0de4de2d5
2 changed files with 1 additions and 3 deletions
-2
View File
@@ -12,7 +12,6 @@ interface AppConfig {
rateLimitWindowMs: number; rateLimitWindowMs: number;
rateLimitMaxRequests: number; rateLimitMaxRequests: number;
trustProxy: boolean; trustProxy: boolean;
uploadConcurrency: number;
batchMaxItems: number; batchMaxItems: number;
batchMaxSizeBytes: number; batchMaxSizeBytes: number;
maxRequestBodyBytes: number; maxRequestBodyBytes: number;
@@ -105,7 +104,6 @@ export const config: AppConfig = {
rateLimitWindowMs: parseNumber(process.env.RATE_LIMIT_WINDOW_MS, 60000), rateLimitWindowMs: parseNumber(process.env.RATE_LIMIT_WINDOW_MS, 60000),
rateLimitMaxRequests: parseNumber(process.env.RATE_LIMIT_MAX_REQUESTS, 150), rateLimitMaxRequests: parseNumber(process.env.RATE_LIMIT_MAX_REQUESTS, 150),
trustProxy: process.env.TRUST_PROXY === 'true', trustProxy: process.env.TRUST_PROXY === 'true',
uploadConcurrency: parseNumber(process.env.UPLOAD_CONCURRENCY, 8),
batchMaxItems: parseNumber(process.env.BATCH_MAX_ITEMS, 20), batchMaxItems: parseNumber(process.env.BATCH_MAX_ITEMS, 20),
batchMaxSizeBytes: parseNumber(process.env.BATCH_MAX_SIZE_BYTES, 500 * 1024 * 1024), batchMaxSizeBytes: parseNumber(process.env.BATCH_MAX_SIZE_BYTES, 500 * 1024 * 1024),
maxRequestBodyBytes: parseNumber(process.env.MAX_REQUEST_BODY_BYTES, 2 * 1024 * 1024 * 1024), maxRequestBodyBytes: parseNumber(process.env.MAX_REQUEST_BODY_BYTES, 2 * 1024 * 1024 * 1024),
+1 -1
View File
@@ -125,7 +125,7 @@ export const uploadFileInTelegramChunks = async (input: {
// Backpressure: if too many chunks are in-flight, wait for one to // Backpressure: if too many chunks are in-flight, wait for one to
// finish before reading more — prevents unbounded memory growth. // finish before reading more — prevents unbounded memory growth.
if (inFlight.size >= config.uploadConcurrency * 2) { if (inFlight.size >= botPool.getEffectiveConcurrency() * 2) {
await Promise.race(inFlight); await Promise.race(inFlight);
// Yield microtask to let .finally() run and remove from inFlight // Yield microtask to let .finally() run and remove from inFlight
await new Promise((resolve) => setTimeout(resolve, 0)); await new Promise((resolve) => setTimeout(resolve, 0));