Update app/utils/aws.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
glay 2024-12-10 11:47:30 +08:00 committed by GitHub
parent 19437c7aa1
commit e455840ab3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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