Enhance processChunks by attempting to recover by processing the next chunk.

This commit is contained in:
glay 2024-12-10 11:53:49 +08:00
parent e455840ab3
commit cb0422b8f2
1 changed files with 4 additions and 0 deletions

View File

@ -609,6 +609,9 @@ export function processChunks(
chunks.shift();
}
} catch (e) {
// console.error("[Chunk Process Error]:", e);
// chunks.shift(); // Remove error chunk
// pendingChunk = null; // Reset pending chunk on error
console.warn("Failed to process chunk, attempting recovery");
// Attempt to recover by processing the next chunk
if (chunks.length > 1) {
@ -618,6 +621,7 @@ export function processChunks(
// If this is the last chunk, throw to prevent data loss
throw new Error("Failed to process final chunk");
}
}
}
return {