Skip to content
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

Merged
merged 3 commits into from
Sep 29, 2022
Merged

aria2 下载增加做种状态 #1422

merged 3 commits into from
Sep 29, 2022

Conversation

XYenon
Copy link
Contributor

@XYenon XYenon commented Jul 31, 2022

aria2 下载完成后将下载内容转存,做种完成后删除下载临时目录

@HFO4
Copy link
Member

HFO4 commented Aug 15, 2022

Great work! Sorry for the delayed review due to summer break, will do it ASAP.

@@ -38,6 +38,8 @@ const (
Downloading
// Paused 暂停中
Paused
// Seeding 做种中
Copy link
Member

@topjohncian topjohncian Aug 19, 2022

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.

Copy link
Contributor Author

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

if download.Status >= common.Error {

Copy link
Member

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!

Copy link
Member

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

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.

Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same as above

Copy link
Member

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

Copy link
Contributor Author

@XYenon XYenon Aug 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, fixed.

// 切换为从机节点处理回收
fs.SwitchToSlaveHandler(node)
handler := fs.Handler.(*slaveinmaster.Driver)
err = handler.Recycle(context.Background(), job.TaskProps.Path)
Copy link
Member

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() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@HFO4 HFO4 merged commit b1685d2 into cloudreve:master Sep 29, 2022
@HFO4
Copy link
Member

HFO4 commented Sep 29, 2022

Thanks for this amazing feature!

@XYenon XYenon deleted the feat/seeding branch October 3, 2022 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants