feat(task-group): introduce TaskGroupCoordinator for coordinated task execution#721
Merged
PIKACHUIM merged 28 commits intoOpenListTeam:mainfrom Jul 24, 2025
Merged
feat(task-group): introduce TaskGroupCoordinator for coordinated task execution#721PIKACHUIM merged 28 commits intoOpenListTeam:mainfrom
PIKACHUIM merged 28 commits intoOpenListTeam:mainfrom
Conversation
refactor(move): move use CopyTask
Co-authored-by: Copilot <[email protected]> Signed-off-by: Seven <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Seven <[email protected]>
dezhishen
requested changes
Jul 15, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a task lifecycle interface, adds a batch-task coordinator for registering hooks that run after all related tasks complete, refactors existing tasks (Move, Copy, Transfer, Upload, Download, Archive) to use the new lifecycle, and standardizes MIME detection using utils.GetMimeType.
- Added
task.Lifecycleinterface andRunWithLifecycleto manageBeforeRun,RunCore, andAfterRunhooks. - Implemented
BatchTaskCoordinatorininternal/task/batch_taskand wired it into file and offline-download operations to perform refresh/remove logic after batches finish. - Replaced ad-hoc
mime.TypeByExtensioncalls withutils.GetMimeTypein WebDAV and HTTP serving code.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| server/webdav/prop.go | Replaced mime.TypeByExtension with utils.GetMimeType |
| server/handles/fsmanage.go | Updated MoveWithTaskAndValidation call to match new signature |
| internal/task/hook.go | Added Lifecycle interface and RunWithLifecycle |
| internal/task/batch_task/refresh.go | Created refreshAndRemove batch‐finish hook |
| internal/task/batch_task/batch_task.go | Introduced BatchTaskCoordinator |
| internal/offline_download/tool/transfer.go | Integrated batch hooks into transfer tasks |
| internal/offline_download/tool/download.go | Integrated batch hooks into download tasks |
| internal/offline_download/tool/add.go | Propagated ApiUrl and batch hooks into AddURL tasks |
| internal/net/serve.go | Switched HTTP serving to use utils.GetMimeType |
| internal/fs/put.go | Refactored upload tasks to lifecycle and added batch hooks |
| internal/fs/move.go | Refactored move tasks to lifecycle and integrated batch hooks |
| internal/fs/fs.go | Updated MoveWithTaskAndValidation signature |
| internal/fs/copy.go | Refactored copy tasks to lifecycle and added batch hooks |
| internal/fs/archive.go | Integrated batch hooks into archive download/upload tasks |
| internal/bootstrap/batch_task.go | Initialized batch‐task hook in bootstrap |
| cmd/server.go | Registered batch‐task hook on server startup |
Comments suppressed due to low confidence (3)
internal/task/batch_task/batch_task.go:19
- Typo in function name:
NewBatchTasCoordinatorshould be spelledNewBatchTaskCoordinatorfor clarity and consistency.
func NewBatchTasCoordinator(name string) *BatchTaskCoordinator {
internal/task/batch_task/batch_task.go:33
- Consider adding unit tests for
BatchTaskCoordinatormethods (AddTask,MarkTaskFinish,SetAllFinishHook) to verify that payloads are tracked correctly and hooks fire when counts reach zero.
func (bt *BatchTaskCoordinator) AddTask(targetPath string, payload any) {
server/handles/fsmanage.go:104
- The original
validateExistenceflag (!req.Overwrite) was removed here, changing overwrite behavior. Reintroduce an explicit overwrite parameter or restore the previous call signature to preserve intended semantics.
t, err := fs.MoveWithTaskAndValidation(c.Request.Context(), stdpath.Join(srcDir, name), dstDir, len(req.Names) > i+1)
Member
|
没活了,就这样吧,再测试测试 没bug的话就合了 |
Member
Author
本地测试了下,没发现明显问题 |
Member
|
@Seven66677731 @j2rong4cn 辛苦看下冲突 |
… the directory that was copied or moved to." This reverts commit 5f03edd.
Member
Author
|
Suyunmeng
pushed a commit
that referenced
this pull request
Jul 30, 2025
… execution (#721) * feat(task): add task hook,batch task refactor(move): move use CopyTask * Update internal/task/batch_task/refresh.go Co-authored-by: Copilot <[email protected]> Signed-off-by: Seven <[email protected]> * fix: upload task allFinish judge * Update internal/task/batch_task/refresh.go Co-authored-by: Copilot <[email protected]> Signed-off-by: Seven <[email protected]> * feat: enhance concurrency safety * 优化代码 * 解压缩 * 修复死锁 * refactor(move): move as task * 重构,优化 * . * 优化,修复bug * . * 修复bug * feat: add task retry judge * 代理Task.SetState函数来判断Task的生命周期 * chore: use OnSucceeded、OnFailed、OnBeforeRetry functions * 优化 * 优化,去除重复代码 * . * 优化 * . * webdav * Revert "fix(fs):After the file is copied or moved, flush the cache of the directory that was copied or moved to." This reverts commit 5f03edd. --------- Signed-off-by: Seven <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: j2rong4cn <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
添加任务hook函数
添加批量任务完成后操作
移动操作改用复制任务