mirror of
https://git.sanhost.net/sanasol/hytale-f2p.git
synced 2026-02-26 06:41:47 -03:00
fix: lastProgressTime variable init
This commit is contained in:
@@ -71,6 +71,7 @@ async function downloadFile(url, dest, progressCallback, maxRetries = 5) {
|
|||||||
// Create AbortController for proper stream control
|
// Create AbortController for proper stream control
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
let hasReceivedData = false;
|
let hasReceivedData = false;
|
||||||
|
let lastProgressTime = Date.now(); // Initialize before timeout
|
||||||
|
|
||||||
// Smart overall timeout - only trigger if no progress for extended period
|
// Smart overall timeout - only trigger if no progress for extended period
|
||||||
const overallTimeout = setInterval(() => {
|
const overallTimeout = setInterval(() => {
|
||||||
@@ -135,7 +136,7 @@ async function downloadFile(url, dest, progressCallback, maxRetries = 5) {
|
|||||||
const contentLength = response.headers['content-length'];
|
const contentLength = response.headers['content-length'];
|
||||||
const totalSize = contentLength ? parseInt(contentLength, 10) + startByte : 0; // Adjust for resume
|
const totalSize = contentLength ? parseInt(contentLength, 10) + startByte : 0; // Adjust for resume
|
||||||
let downloaded = startByte; // Start with existing bytes
|
let downloaded = startByte; // Start with existing bytes
|
||||||
let lastProgressTime = Date.now();
|
lastProgressTime = Date.now(); // Update time after response received
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
|
|
||||||
// Check network status before attempting download
|
// Check network status before attempting download
|
||||||
|
|||||||
Reference in New Issue
Block a user