Repository navigation
fix: continue syncing remaining WAL batches when one fails - #4869
Conversation
Previously, if any batch of files failed to upload (e.g. due to a future timestamp causing a 400 error), the exception would propagate up and abort the entire sync. Files with valid timestamps that hadn't been sent yet would also fail to sync. Now the failed batch is skipped and the loop continues with remaining batches. Failed WALs stay as 'miss' on disk and will be retried on the next sync. Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request correctly addresses an issue where a single failed WAL sync batch would abort the entire process. By changing rethrow to allow the loop to continue, it improves the robustness of the sync mechanism. However, I've identified a potential issue with state management in the failure case. My review includes a suggestion to ensure the UI and persisted state are correctly updated when a batch fails, preventing a stale 'syncing' status.
Remove `continue` so that _saveWalsToFile() and onWalUpdated() run after a failed batch, ensuring isSyncing=false is persisted to disk and the UI is updated. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Hey 👋 — thanks for putting this together! Before we can review, could you share a quick live demo (screenshot, screen recording, or terminal output) showing this working on your local or dev environment? In the AI era, writing code is the easy part — what really makes a PR stand out is proof that it works end-to-end. A short video or even a screenshot goes a long way in helping reviewers feel confident about merging. Feel free to update this PR whenever you have something to show. Thanks! 🙏 |
…ware#4869) ## Summary - When uploading WAL files to the backend, files are sent in batches of 3. If any batch fails (e.g. a file has a future timestamp causing a 400 error from the server), the entire sync was aborted due to a `rethrow` in the catch block. - This meant valid files with past timestamps that hadn't been sent yet would also fail to sync, even though they would succeed individually. - Changed `rethrow` to `continue` so a failed batch is skipped and the remaining batches still get processed. Failed WALs remain as `miss` on disk and will be retried on the next sync cycle. ## Test plan - [x] Verify that if one batch of WAL files fails to upload (e.g. server returns 400), the remaining batches still sync successfully - [x] Verify that failed WALs remain with `miss` status and are retried on the next sync - [x] Verify normal sync flow (all batches succeed) is unaffected 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ware#4869) ## Summary - When uploading WAL files to the backend, files are sent in batches of 3. If any batch fails (e.g. a file has a future timestamp causing a 400 error from the server), the entire sync was aborted due to a `rethrow` in the catch block. - This meant valid files with past timestamps that hadn't been sent yet would also fail to sync, even though they would succeed individually. - Changed `rethrow` to `continue` so a failed batch is skipped and the remaining batches still get processed. Failed WALs remain as `miss` on disk and will be retried on the next sync cycle. ## Test plan - [x] Verify that if one batch of WAL files fails to upload (e.g. server returns 400), the remaining batches still sync successfully - [x] Verify that failed WALs remain with `miss` status and are retried on the next sync - [x] Verify normal sync flow (all batches succeed) is unaffected 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
rethrowin the catch block.rethrowtocontinueso a failed batch is skipped and the remaining batches still get processed. Failed WALs remain asmisson disk and will be retried on the next sync cycle.Test plan
missstatus and are retried on the next sync🤖 Generated with Claude Code