diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-10-29 10:57:27 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-10-29 10:57:27 +0100 |
commit | 28d844642a1f450da26ac68e5bd542006be8fe5d (patch) | |
tree | b2616203b8df43807e6d81120483b8dfa24ad7d8 /modules/collect.go | |
parent | eb5fd3127f3d557cc9771756c400baf4d12d2b4e (diff) |
Revert "modules: Throttle the "downloading modules …" log entries"
This reverts commit 66904097e02fc3e846ec87a9db023df92cf613ba.
Diffstat (limited to 'modules/collect.go')
-rw-r--r-- | modules/collect.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/collect.go b/modules/collect.go index 148886607..5b5418bcd 100644 --- a/modules/collect.go +++ b/modules/collect.go @@ -15,7 +15,6 @@ package modules import ( "bufio" - "errors" "fmt" "os" "path/filepath" @@ -23,6 +22,7 @@ import ( "strings" "time" + "github.com/bep/debounce" "github.com/gohugoio/hugo/common/herrors" "github.com/gohugoio/hugo/common/loggers" @@ -37,6 +37,8 @@ import ( "github.com/rogpeppe/go-internal/module" + "errors" + "github.com/gohugoio/hugo/config" "github.com/spf13/afero" ) @@ -122,6 +124,7 @@ func (m ModulesConfig) HasConfigFile() bool { if len(mod.ConfigFilenames()) > 0 { return true } + } return false } @@ -217,6 +220,7 @@ func (c *collector) getVendoredDir(path string) (vendoredModule, bool) { } func (c *collector) add(owner *moduleAdapter, moduleImport Import) (*moduleAdapter, error) { + var ( mod *goModule moduleDir string @@ -505,10 +509,11 @@ LOOP: func (c *collector) collect() { defer c.logger.PrintTimerIfDelayed(time.Now(), "hugo: collected modules") - - c.throttle(func() { + d := debounce.New(2 * time.Second) + d(func() { c.logger.Println("hugo: downloading modules …") }) + defer d(func() {}) if err := c.initModules(); err != nil { c.err = err @@ -664,6 +669,7 @@ func (c *collector) normalizeMounts(owner *moduleAdapter, mounts []Mount) ([]Mou } else { continue } + } // Verify that target points to one of the predefined component dirs |