mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
hugolib: Cleanup the Goroutine count calculation
This commit is contained in:
parent
91968f3b1f
commit
13972d6c83
3 changed files with 10 additions and 10 deletions
|
@ -484,8 +484,9 @@ func (h *HugoSites) setupTranslations() {
|
||||||
func (s *Site) preparePagesForRender(cfg *BuildCfg) {
|
func (s *Site) preparePagesForRender(cfg *BuildCfg) {
|
||||||
pageChan := make(chan *Page)
|
pageChan := make(chan *Page)
|
||||||
wg := &sync.WaitGroup{}
|
wg := &sync.WaitGroup{}
|
||||||
|
numWorkers := getGoMaxProcs() * 4
|
||||||
|
|
||||||
for i := 0; i < getGoMaxProcs()*4; i++ {
|
for i := 0; i < numWorkers; i++ {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(pages <-chan *Page, wg *sync.WaitGroup) {
|
go func(pages <-chan *Page, wg *sync.WaitGroup) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
|
@ -1150,11 +1150,10 @@ func (s *Site) readPagesFromSource() chan error {
|
||||||
files := s.Source.Files()
|
files := s.Source.Files()
|
||||||
results := make(chan HandledResult)
|
results := make(chan HandledResult)
|
||||||
filechan := make(chan *source.File)
|
filechan := make(chan *source.File)
|
||||||
procs := getGoMaxProcs()
|
|
||||||
wg := &sync.WaitGroup{}
|
wg := &sync.WaitGroup{}
|
||||||
|
numWorkers := getGoMaxProcs() * 4
|
||||||
wg.Add(procs * 4)
|
wg.Add(numWorkers)
|
||||||
for i := 0; i < procs*4; i++ {
|
for i := 0; i < numWorkers; i++ {
|
||||||
go sourceReader(s, filechan, results, wg)
|
go sourceReader(s, filechan, results, wg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,11 +1177,11 @@ func (s *Site) convertSource() chan error {
|
||||||
results := make(chan HandledResult)
|
results := make(chan HandledResult)
|
||||||
pageChan := make(chan *Page)
|
pageChan := make(chan *Page)
|
||||||
fileConvChan := make(chan *source.File)
|
fileConvChan := make(chan *source.File)
|
||||||
procs := getGoMaxProcs()
|
numWorkers := getGoMaxProcs() * 4
|
||||||
wg := &sync.WaitGroup{}
|
wg := &sync.WaitGroup{}
|
||||||
|
|
||||||
wg.Add(2 * procs * 4)
|
for i := 0; i < numWorkers; i++ {
|
||||||
for i := 0; i < procs*4; i++ {
|
wg.Add(2)
|
||||||
go fileConverter(s, fileConvChan, results, wg)
|
go fileConverter(s, fileConvChan, results, wg)
|
||||||
go pageConverter(pageChan, results, wg)
|
go pageConverter(pageChan, results, wg)
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,11 @@ func (s *Site) renderPages() error {
|
||||||
|
|
||||||
go errorCollator(results, errs)
|
go errorCollator(results, errs)
|
||||||
|
|
||||||
procs := getGoMaxProcs()
|
numWorkers := getGoMaxProcs() * 4
|
||||||
|
|
||||||
wg := &sync.WaitGroup{}
|
wg := &sync.WaitGroup{}
|
||||||
|
|
||||||
for i := 0; i < procs*4; i++ {
|
for i := 0; i < numWorkers; i++ {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go pageRenderer(s, pages, results, wg)
|
go pageRenderer(s, pages, results, wg)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue