-
Notifications
You must be signed in to change notification settings - Fork 3
fix: creating snapshots of S3 objects #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes the creation of snapshots for S3 objects by addressing concurrency issues in the download error handling and adding support for S3 directory objects (zero-byte objects with trailing slashes).
Key changes:
- Simplified error handling in concurrent S3 downloads by using a buffered channel and proper goroutine synchronization
- Refactored duplicate S3 download logic into a reusable helper function
- Added special handling for S3 directory objects to prevent file creation errors
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/util/s3.go | Fixed error channel buffering and simplified error propagation pattern in the S3 download bucket function |
| internal/snapshot/s3.go | Refactored duplicate download logic into processDownloadObject helper function and added directory object handling |
| .gitignore | Added .DS_Store to ignore macOS system files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
956aae9 to
da28027
Compare
5382f7e to
7c30631
Compare
This pull request refactors and improves the S3 backup logic for asset snapshots, focusing on code reuse, error handling, and concurrency management. The main change is the extraction of the S3 object download logic into a reusable function, which simplifies the backup process for both private and public buckets. Additionally, the S3 downloader's concurrency and error propagation mechanisms are improved for reliability.
Refactoring and code reuse:
processDownloadObject, which is now used for both private and public bucket backups. This reduces code duplication and centralizes file handling and error reporting. [1] [2]Error handling and logging improvements:
S3 downloader concurrency and error propagation:
DownloadBucketmethod inS3Downloaderto ensure that the error channel is properly closed after all goroutines complete, and that the first encountered error is returned immediately to halt further processing. Also added explicit comments and improved semaphore handling for clarity. [1] [2] [3] [4]Minor improvements:
stringspackage import to support directory/file checks in the new download logic.