-
Notifications
You must be signed in to change notification settings - Fork 96
feat(fs): slice upload #187
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
base: main
Are you sure you want to change the base?
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 implements slice upload functionality for the file upload system. The slice upload feature allows large files to be uploaded in multiple chunks/slices for better reliability and potentially resumable uploads.
Key changes include:
- Addition of slice upload core logic with concurrent chunk uploading
- New API interfaces for slice upload operations (preup, upload info, complete)
- Integration of slice upload option into existing upload flows
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
vite.config.ts | Externalized p-limit dependency for chunk management |
src/types/resp.ts | Added response types for slice upload API endpoints |
src/pages/home/uploads/util.ts | Enhanced hash calculation and added slice upload utility functions |
src/pages/home/uploads/types.ts | Added HashInfo type and slice upload parameter to Upload type |
src/pages/home/uploads/stream.ts | Integrated slice upload option into stream upload flow |
src/pages/home/uploads/slice_upload.ts | Core slice upload implementation with concurrent uploading |
src/pages/home/uploads/form.ts | Added slice upload option to form upload flow |
src/pages/home/uploads/Upload.tsx | Added slice upload checkbox to UI |
src/lang/en/home.json | Added localization for slice upload option |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
onUploadProgress: async (progressEvent) => { | ||
log() |
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.
The log() function is called without any arguments on line 106, which may not provide useful debugging information. Consider adding meaningful parameters or removing if not needed.
onUploadProgress: async (progressEvent) => { | |
log() |
Copilot uses AI. Check for mistakes.
oldLoaded = progressEvent.loaded | ||
} finally { | ||
progressMutex.release() |
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.
The mutex is being released incorrectly. The 'release' variable from 'progressMutex.acquire()' should be called, not 'progressMutex.release()'. Change line 118 to 'release()' instead.
oldLoaded = progressEvent.loaded | |
} finally { | |
progressMutex.release() | |
release() |
Copilot uses AI. Check for mistakes.
const speed = intervalLoaded / ((Date.now() - lastTimestamp) / 1000) | ||
const complete = Math.min(100, ((uploadedBytes / file.size) * 100) | 0) |
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.
The bitwise OR operation '| 0' for rounding is unclear. Use 'Math.floor()' instead for better readability and explicit intent.
const speed = intervalLoaded / ((Date.now() - lastTimestamp) / 1000) | |
const complete = Math.min(100, ((uploadedBytes / file.size) * 100) | 0) | |
const complete = Math.min(100, Math.floor((uploadedBytes / file.size) * 100)) |
Copilot uses AI. Check for mistakes.
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
优化了上传状态展示 |
…ce upload functions
…ent, and memory optimization
…th check, error handling, and retry mechanisms
…rocessing logic after server restart, and adjusted the retry configuration
…frontend into pr/jenken827/187
参见:feat:支持分片上传