加固sizeLimit 兜底
This commit is contained in:
+2
-2
@@ -204,8 +204,8 @@ func (c *Crawler) visitURL(rawURL string) (hrefs []string) {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
// 礼貌模式抓取(遵守 robots.txt + 限流),不限制大小
|
||||
res, fetchErr = c.fetcher.fetchWithHistory(rawURL, true, fetchTimeout, 0)
|
||||
// 礼貌模式抓取(遵守 robots.txt + 限流),限制页面大小防止内存爆炸
|
||||
res, fetchErr = c.fetcher.fetchWithHistory(rawURL, true, fetchTimeout, config.MaxPageSize())
|
||||
}()
|
||||
waitCh := make(chan struct{})
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user