Skip to content

Conversation

@chain710
Copy link
Contributor

@chain710 chain710 commented May 8, 2024

支持给每个site独立限制torrent数量

[[sites]]
name = 'xxx
type = 'xxx'
allowAddTorrentsPercent = 0.5

此处allowAddTorrentsPercent是clientConfig.BrushMaxTorrents的比例

不配置的行为和以前一致

我自己的使用场景是防止某些站点占据过多刷流的种子

@sagan
Copy link
Owner

sagan commented May 9, 2024

感谢 pr。

allowAddTorrentsPercent 配置项是刷流专用,名称应该加上 brush 前缀,在 SiteConfigStruct 里和其他 Brush 选项放在一起。建议不要用指针,直接用 float64,默认的 0 值和不配置应该没有必要区分。

我最近几次 commit 改动了很多文件,请 rebase 下再提交。

@chain710
Copy link
Contributor Author

chain710 commented May 9, 2024

默认的 0 值和不配置应该没有必要区分

似乎会变成不配置(默认0值)不允许刷流,因为计算出来的allowTorrents=0

@chain710 chain710 force-pushed the feat/allowpersite branch 2 times, most recently from 1df89be to 4a31da0 Compare May 9, 2024 10:55
@chain710
Copy link
Contributor Author

chain710 commented May 9, 2024

已经rebase

@sagan
Copy link
Owner

sagan commented May 10, 2024

默认的 0 值和不配置应该没有必要区分

似乎会变成不配置(默认0值)不允许刷流,因为计算出来的allowTorrents=0

就是把 AllowAddTorrentsPercent != nil 换成 AllowAddTorrentsPercent != 0。

0 就作为之前的 nil 处理。

@chain710 chain710 force-pushed the feat/allowpersite branch from 4a31da0 to 5894822 Compare May 10, 2024 02:07
@chain710 chain710 force-pushed the feat/allowpersite branch from 5894822 to 9240ad6 Compare May 10, 2024 02:23
@chain710
Copy link
Contributor Author

chain710 commented May 10, 2024

根据意见调整完毕

配置brushAllowAddTorrentsPercent改为int,取值范围[0, 100], 0或不配置代表不限制,向前兼容

@sagan sagan merged commit bd42934 into sagan:master May 10, 2024
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