summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/pagebundler.go8
-rw-r--r--hugolib/pagebundler_capture.go8
-rw-r--r--hugolib/site.go9
-rw-r--r--hugolib/site_render.go4
4 files changed, 9 insertions, 20 deletions
diff --git a/hugolib/pagebundler.go b/hugolib/pagebundler.go
index 682221d8c..5149968bc 100644
--- a/hugolib/pagebundler.go
+++ b/hugolib/pagebundler.go
@@ -18,7 +18,8 @@ import (
"fmt"
"math"
"path/filepath"
- "runtime"
+
+ "github.com/gohugoio/hugo/config"
_errors "github.com/pkg/errors"
@@ -73,10 +74,7 @@ func (s *siteContentProcessor) processAsset(asset pathLangFile) {
}
func newSiteContentProcessor(ctx context.Context, partialBuild bool, s *Site) *siteContentProcessor {
- numWorkers := 12
- if n := runtime.NumCPU() * 3; n > numWorkers {
- numWorkers = n
- }
+ numWorkers := config.GetNumWorkerMultiplier() * 3
numWorkers = int(math.Ceil(float64(numWorkers) / float64(len(s.h.Sites))))
diff --git a/hugolib/pagebundler_capture.go b/hugolib/pagebundler_capture.go
index 17a4b865a..7c01a751d 100644
--- a/hugolib/pagebundler_capture.go
+++ b/hugolib/pagebundler_capture.go
@@ -19,7 +19,8 @@ import (
"os"
"path"
"path/filepath"
- "runtime"
+
+ "github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/common/loggers"
_errors "github.com/pkg/errors"
@@ -70,10 +71,7 @@ func newCapturer(
contentChanges *contentChangeMap,
filenames ...string) *capturer {
- numWorkers := 4
- if n := runtime.NumCPU(); n > numWorkers {
- numWorkers = n
- }
+ numWorkers := config.GetNumWorkerMultiplier()
// TODO(bep) the "index" vs "_index" check/strings should be moved in one place.
isBundleHeader := func(filename string) bool {
diff --git a/hugolib/site.go b/hugolib/site.go
index 84ee7823c..616b5b37d 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1881,15 +1881,6 @@ func (s *Site) newPage(kind string, sections ...string) *pageState {
return p
}
-func getGoMaxProcs() int {
- if gmp := os.Getenv("GOMAXPROCS"); gmp != "" {
- if p, err := strconv.Atoi(gmp); err == nil {
- return p
- }
- }
- return 1
-}
-
func (s *Site) shouldBuild(p page.Page) bool {
return shouldBuild(s.BuildFuture, s.BuildExpired,
s.BuildDrafts, p.Draft(), p.PublishDate(), p.ExpiryDate())
diff --git a/hugolib/site_render.go b/hugolib/site_render.go
index f3df09f09..1d8b14b0a 100644
--- a/hugolib/site_render.go
+++ b/hugolib/site_render.go
@@ -19,6 +19,8 @@ import (
"strings"
"sync"
+ "github.com/gohugoio/hugo/config"
+
"github.com/gohugoio/hugo/output"
"github.com/pkg/errors"
@@ -55,7 +57,7 @@ func (s siteRenderContext) renderSingletonPages() bool {
// TODO(bep np doc
func (s *Site) renderPages(ctx *siteRenderContext) error {
- numWorkers := getGoMaxProcs() * 4
+ numWorkers := config.GetNumWorkerMultiplier()
results := make(chan error)
pages := make(chan *pageState, numWorkers) // buffered for performance