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

Alist存储间的复制优化 #3776

Closed
4 tasks done
dixtdf opened this issue Mar 9, 2023 · 5 comments
Closed
4 tasks done

Alist存储间的复制优化 #3776

dixtdf opened this issue Mar 9, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@dixtdf
Copy link

dixtdf commented Mar 9, 2023

Please make sure of the following things

  • I have read the documentation.
  • I'm sure there are no duplicate issues or discussions.
  • I'm sure this feature is not implemented.
  • I'm sure it's a reasonable and popular requirement.

Description of the feature / 需求描述

当复制文件过多时http://127.0.0.1:5244/@manage/tasks/copy界面会非常卡,希望可以分割已完成和未完成任务

Suggested solution / 实现思路

通过分页或限制页面dom加载数量实现性能优化

Additional context / 附件

No response

@dixtdf dixtdf added the enhancement New feature or request label Mar 9, 2023
@welcome
Copy link

welcome bot commented Mar 9, 2023

Thanks for opening your first issue here! Be sure to follow the issue template!

@github-actions
Copy link

github-actions bot commented Mar 9, 2023

See

  1. 100% Alist存储间的复制优化 #3507

@dixtdf
Copy link
Author

dixtdf commented Mar 9, 2023

  1. 100%Alist存储间的复制优化 #3507

非#3507所述问题

@mnpq-top
Copy link

mnpq-top commented Mar 9, 2023

同时希望支持筛选出错的任务并重试

@12189108
Copy link

12189108 commented Mar 12, 2023

同时希望支持筛选出错的任务并重试

下面是我用python实现的功能,可能有问题(别喷我的代码),但可以临时用一下(有大佬能帮忙优化一下最好🙃):

import re
import requests

# 你部署alist的网址,如http://xx.xx,https://xx.xx
domain = ""
state_url = domain + "/api/admin/task/copy/done"
copy_url = domain + "/api/fs/copy"
clear_url = domain + "/api/admin/task/copy/delete?tid="
# 管理-设置-其他-令牌里的东西
auth_token = ""


def retry_failed_task():
    header = {"Authorization": auth_token}
    req = requests.get(state_url, headers=header)
    data = req.json()
    if data["code"] == 200:
        data = data["data"]
        if data:
            for task in data:
                if task["state"] == "errored":
                    task_content = task["name"]
                    pre_dirs = re.findall(r"\[.+?\]", task_content)
                    pre_content = re.findall(r"\(.+?\)", task_content)
                    pre_src_dir = pre_dirs[0][1:-1]
                    pre_src_dir += pre_content[0][1:-1]
                    split_point = pre_src_dir.rfind("/")
                    src_dir = pre_src_dir[:split_point]
                    names = [pre_src_dir[split_point + 1:]]
                    dst_dir = pre_dirs[-int(len(pre_dirs)/2)][1:-1] + pre_content[-int(len(pre_content)/2)][1:-1]
                    add_task = {"src_dir": src_dir, "dst_dir": dst_dir, "names": names}
                    req = requests.post(copy_url, headers=header, json=add_task)
                    result = req.json()
                    if result["code"] != 200:
                        print(task_content)
                        print(result)
                    else:
                        print("retry success")
                        print(requests.post(clear_url+task["id"], headers=header).json())
                else:
                    print(requests.post(clear_url+task["id"], headers=header).json())
    else:
        print(data)


retry_failed_task()

@xhofe xhofe closed this as completed in 8c0defc Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants
@12189108 @dixtdf @mnpq-top and others