mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
modules: Throttle the "downloading modules …" log entries
This commit is contained in:
@@ -15,6 +15,7 @@ package modules
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -22,7 +23,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/bep/debounce"
|
||||
"github.com/gohugoio/hugo/common/herrors"
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
|
||||
@@ -37,8 +37,6 @@ import (
|
||||
|
||||
"github.com/rogpeppe/go-internal/module"
|
||||
|
||||
"errors"
|
||||
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
@@ -124,7 +122,6 @@ func (m ModulesConfig) HasConfigFile() bool {
|
||||
if len(mod.ConfigFilenames()) > 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -220,7 +217,6 @@ func (c *collector) getVendoredDir(path string) (vendoredModule, bool) {
|
||||
}
|
||||
|
||||
func (c *collector) add(owner *moduleAdapter, moduleImport Import) (*moduleAdapter, error) {
|
||||
|
||||
var (
|
||||
mod *goModule
|
||||
moduleDir string
|
||||
@@ -509,11 +505,10 @@ LOOP:
|
||||
|
||||
func (c *collector) collect() {
|
||||
defer c.logger.PrintTimerIfDelayed(time.Now(), "hugo: collected modules")
|
||||
d := debounce.New(2 * time.Second)
|
||||
d(func() {
|
||||
|
||||
c.throttle(func() {
|
||||
c.logger.Println("hugo: downloading modules …")
|
||||
})
|
||||
defer d(func() {})
|
||||
|
||||
if err := c.initModules(); err != nil {
|
||||
c.err = err
|
||||
@@ -669,7 +664,6 @@ func (c *collector) normalizeMounts(owner *moduleAdapter, mounts []Mount) ([]Mou
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Verify that target points to one of the predefined component dirs
|
||||
|
Reference in New Issue
Block a user