-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
perf(ftp): improve concurrent Link response; fix alias/local driver issues #974
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 focuses on performance improvements for the FTP driver and fixes thread-safety issues in the alias and local drivers related to Link responses. The changes optimize concurrent Link handling while addressing issues with shared MFile objects that are not thread-safe.
- Optimizes FTP driver concurrent Link responses by removing custom FileReader and using direct range requests
- Fixes alias driver concurrent Link responses to prevent shared MFile thread-safety issues
- Corrects local driver thumbnail RangeReader size handling
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/utils/io.go | Refactors SyncClosers to use atomic operations and removes redundant error handling in CopyWithBuffer |
| internal/stream/util.go | Simplifies GetRangeReaderFromMFile to return proper interface type |
| internal/stream/stream.go | Refactors RangeReadReadAtSeeker to use sync.Map and simplifies caching logic |
| internal/op/fs.go | Adds MFile caching prevention logic for concurrent Link requests |
| internal/model/args.go | Removes redundant Close method from Link struct |
| drivers/ftp/driver.go | Completely rewrites FTP Link implementation for better concurrency |
| drivers/local/driver.go | Fixes ContentLength assignment for thumbnails |
| drivers/alias/driver.go | Adds proper Link copying to prevent shared MFile issues |
| Multiple driver files | Various cleanups and optimizations |
- Return actual error instead of nil in stream range read failure - Fix buffer copy bounds to prevent out-of-range access - Improve FTP FileReader loop termination and error propagation - Ensure partial reads are properly handled with context cancellation
Suyunmeng
left a comment
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.
LGTM
主要修改