-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
aria2 下载增加做种状态 #1422
aria2 下载增加做种状态 #1422
Conversation
Great work! Sorry for the delayed review due to summer break, will do it ASAP. |
pkg/aria2/common/common.go
Outdated
@@ -38,6 +38,8 @@ const ( | |||
Downloading | |||
// Paused 暂停中 | |||
Paused | |||
// Seeding 做种中 |
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.
In my opinion, we'd better move the newly added status enums to the end.
Otherwise, conflicts may occur in programs which stored enum values.
For example, enum value 5
means Complete before upgrade, but after the upgrade 5
means Error.
Or maybe I'm overthinking 😃 , correct me, please.
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.
It should be less than error, because
Cloudreve/service/aria2/manage.go
Line 60 in 96daed2
if download.Status >= common.Error { |
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.
You're right, it's my wrong. 😅
I'm looking forward to the merge!
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.
It should be less than error, because
Cloudreve/service/aria2/manage.go
Line 60 in 96daed2
if download.Status >= common.Error {
We should append new enum to the end as @topjohncian suggested, and refactor the line#60.
Inserting new enum in the middle will break backwards compatibility: Download record in database from old version with be mapped to wrong enum in new version.
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.
Done
pkg/task/job.go
Outdated
@@ -13,6 +13,8 @@ const ( | |||
DecompressTaskType | |||
// TransferTaskType 中转任务 | |||
TransferTaskType | |||
// RecycleTaskType 回收任务 | |||
RecycleTaskType |
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 same as above
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.
This enum is saved in DTO.
And maybe GetJobFromModel
will get confusing
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.
You are right, fixed.
pkg/task/recycle.go
Outdated
// 切换为从机节点处理回收 | ||
fs.SwitchToSlaveHandler(node) | ||
handler := fs.Handler.(*slaveinmaster.Driver) | ||
err = handler.Recycle(context.Background(), job.TaskProps.Path) |
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.
Why not use node.GetAria2Instance().DeleteTempFile()
?
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.
Done
Thanks for this amazing feature! |
aria2 下载完成后将下载内容转存,做种完成后删除下载临时目录