mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
hugolib: Avoid processing the same notify event twice
On `macOS`, at least, we've seen multiple WRITE events for same file, and no need to do the same job twice.
This commit is contained in:
@@ -633,8 +633,15 @@ func (s *Site) reProcess(events []fsnotify.Event) (whatChanged, error) {
|
|||||||
shortcodesChanged := make(map[string]bool)
|
shortcodesChanged := make(map[string]bool)
|
||||||
// prevent spamming the log on changes
|
// prevent spamming the log on changes
|
||||||
logger := helpers.NewDistinctFeedbackLogger()
|
logger := helpers.NewDistinctFeedbackLogger()
|
||||||
|
seen := make(map[fsnotify.Event]bool)
|
||||||
|
|
||||||
for _, ev := range events {
|
for _, ev := range events {
|
||||||
|
// Avoid processing the same event twice.
|
||||||
|
if seen[ev] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
seen[ev] = true
|
||||||
|
|
||||||
if s.isContentDirEvent(ev) {
|
if s.isContentDirEvent(ev) {
|
||||||
logger.Println("Source changed", ev.Name)
|
logger.Println("Source changed", ev.Name)
|
||||||
sourceChanged = append(sourceChanged, ev)
|
sourceChanged = append(sourceChanged, ev)
|
||||||
|
Reference in New Issue
Block a user