feat(traffic): support limit task worker count & file stream rate #7948
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.
支持限制 6 种任务的线程数和传输上下行速率。
op.RegisterSettingChangingCallback
方法用来注册一个当设置发生修改时调用的回调函数,这使得设置修改后立即生效成为可能。xhofe/tache
升级到 v0.1.5,使用新版本的SetWorkersNumActive
方法实现运行时修改任务线程数。golang.org/x/time/rate
的Limiter
的限流器: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