Skip to content

Commit

Permalink
Update app/utils/aws.ts
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
glayyiyi and coderabbitai[bot] authored Dec 10, 2024
1 parent 19437c7 commit e455840
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/utils/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,15 @@ 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) {
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 {
Expand Down

0 comments on commit e455840

Please sign in to comment.