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

feat(traffic): support limit task worker count & file stream rate #7948

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

KirCute
Copy link
Contributor

@KirCute KirCute commented Feb 5, 2025

支持限制 6 种任务的线程数和传输上下行速率。

  1. 增加op.RegisterSettingChangingCallback方法用来注册一个当设置发生修改时调用的回调函数,这使得设置修改后立即生效成为可能。
  2. xhofe/tache升级到 v0.1.5,使用新版本的SetWorkersNumActive方法实现运行时修改任务线程数。
  3. 增加四个基于golang.org/x/time/rateLimiter的限流器:
    • ClientDownloadLimit:限制/p/d/ap/ad/ae五个API,WebDAV 服务器的 GET、POST 请求和 FTP 服务器的 RETR 命令的下行速率。
    • ClientUploadLimit:限制/api/fs/put/api/fs/form两个API,WebDAV 服务器的 PUT 请求和 FTP 服务器的 STOR 命令的上行速率。
    • ServerDownloadLimit:限制stream.SeekableStream和本地代理读取model.Link的速率。
    • ServerUploadLimit:限制驱动上传model.FileStreamer的速率,这一步需要在驱动内完成,这也是为什么这个 PR 修改了几乎所有可写驱动。

Front-end part AlistGo/alist-web#250

Close #7511

Comment on lines 179 to 186
err = jsoniter.Unmarshal(body, &erron)
if err != nil {
return nil, err
}
err = xml.Unmarshal(body, &erron)
if err != nil {
return nil, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

这里别改,故意忽略错误的。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

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.

能否添加自定义限速功能
2 participants