mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-25 14:11:14 +00:00
47c91a4ca2
This fixes #450. There are two problems: 1.) We're creating a new goroutine for every page. 2.) We're calling s.Pages = append(s.Pages, page) inside each goroutine. 1 is a problem if in that if you have a ton of pages, that's a ton of goroutines. It's not really useful to have more than a few goroutines at a time, and lots can actually make your code much slower, and, evidently, crash. 2 is a problem in that append is not thread safe. Sometimes it returns a new slice with a larger capacity, when the original slice isn't large enough. This can cause problems if two goroutines do this at the same time. The solution for 1 is to use a limited number of workers (I chose 2*GOMAXPROCS as a nice guess). The solution for 2 is to serialize access to s.Pages, which I did by doing it in a single goroutine. |
||
---|---|---|
.. | ||
benchmark_test.go | ||
menu.go | ||
node.go | ||
page.go | ||
page_permalink_test.go | ||
page_taxonomy_test.go | ||
page_test.go | ||
page_time_integration_test.go | ||
pageGroup.go | ||
pageSort.go | ||
path_seperators_test.go | ||
path_seperators_windows_test.go | ||
permalinks.go | ||
permalinks_test.go | ||
planner.go | ||
redis.cn.md | ||
rss_test.go | ||
shortcode.go | ||
shortcode_test.go | ||
site.go | ||
site_show_plan_test.go | ||
site_test.go | ||
site_url_test.go | ||
siteinfo_test.go | ||
sitemap.go | ||
sitemap_test.go | ||
summary.go | ||
taxonomy.go | ||
taxonomy_test.go | ||
template.go | ||
template_embedded.go | ||
template_test.go |