沒Thread Pool,Limiter也好?真的嗎?

眾所皆知Go是沒有原生的Thread Pool這種東西,這在寫Crawler的時候會造成一些小小的不便。比方說你想要crawl PTT,這樣打一打大概2秒內DDoS protection就把你擋起來了:

docUrlList, _ := GetDocUrlList() //拿到某個版的文章列表
for _, docUrl := range docUrlList {
	go func() {
		docUrl := docUrl
		p, _ := ParseSingleRawDocument(docUrl)
		parseChannel <- p
	}()
}
Read more “沒Thread Pool,Limiter也好?真的嗎?”
2 Comments