手动添加的url返回的url不限制数量

This commit is contained in:
2026-04-10 14:52:58 +08:00
parent 35d9e5cfc1
commit 06b8116b79
2 changed files with 36 additions and 8 deletions
+10
View File
@@ -47,6 +47,7 @@ type CrawlerConfig struct {
RecrawlMaxAge int `yaml:"recrawl_max_age"` // URL 过期时间(秒),超过此时间的 URL 允许被重爬,默认 30 天
RecrawlCheckInterval int `yaml:"recrawl_check_interval"` // 运行期间检查过期 URL 的间隔(秒),默认 1 小时
RecrawlBatchSize int `yaml:"recrawl_batch_size"` // 每次检查最多释放多少个过期 URL,默认 500
MaxPriorityChildren int `yaml:"max_priority_children"` // priorityChildren 队列的最大链接数,默认 100
}
// SearchConfig 搜索结果排序权重配置
@@ -128,6 +129,7 @@ func GetDefaultConfig() Config {
RecrawlMaxAge: 30 * 86400, // 30 天
RecrawlCheckInterval: 3600, // 1 小时
RecrawlBatchSize: 500,
MaxPriorityChildren: 100,
},
Search: SearchConfig{
UseOnlineSnippet: true,
@@ -274,5 +276,13 @@ func PromPortBacklink() int { return Global.Prometheus.BacklinkPort }
// PromPortSearch 返回配置值
func PromPortSearch() int { return Global.Prometheus.SearchPort }
// MaxPriorityChildren 返回 priorityChildren 队列的最大链接数(0=不限)。
func MaxPriorityChildren() int {
if Global.Crawler.MaxPriorityChildren <= 0 {
return 100 // 默认 100
}
return Global.Crawler.MaxPriorityChildren
}
// 为了向后兼容,保留 StoragePath 常量
const StoragePath = "./savedata"