mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-05-11 14:21:15 +00:00
fix: improve download/upload reliability and fix FILE_PARTS_INVALID
- Add downloadStarted flag to prevent false "stopped unexpectedly" errors when TDLib emits initial updateFile before download is active - Add 5-minute stall detection for both downloads and uploads - Reduce max split part size from 2GiB to 1950MiB to stay under Telegram's internal upload part count limits - Increase timeouts from max(10min, 15min/GB) to max(15min, 20min/GB) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,8 +6,12 @@ import { childLogger } from "../util/logger.js";
|
||||
|
||||
const log = childLogger("split");
|
||||
|
||||
/** 2GB in bytes — Telegram's file size limit */
|
||||
const MAX_PART_SIZE = 2n * 1024n * 1024n * 1024n;
|
||||
/**
|
||||
* 1950 MiB — safely under Telegram's 2GB upload limit.
|
||||
* At exactly 2GiB, TDLib's internal 512KB chunking can exceed Telegram's
|
||||
* 4000-part threshold, causing FILE_PARTS_INVALID errors.
|
||||
*/
|
||||
const MAX_PART_SIZE = 1950n * 1024n * 1024n;
|
||||
|
||||
/**
|
||||
* Split a file into ≤2GB parts using byte-level splitting.
|
||||
|
||||
Reference in New Issue
Block a user