I’m running into an issue with my very large (~1k pages) project. As part of the site’s build, I copy site files (markdown, images) from disparate folders in the repo into the content folder, and then run hugo serve. When I script this, hugo serve gets stuck in a rebuild loop, triggering on CHMOD events, like so:
INFO 2022/04/11 22:18:37 Received System Events: ["<repo>/content/restaurant/orders-workflow/menu-item-search/media/service_component_diagram.png": CHMOD "<repo>/content/restaurant/orders-workflow/order-ready-communication-service/media/order-ready-communication-service.svg": CHMOD
for about every file in the content folder. I was looking through Discourse and the source, and found this hugo/hugo.go at master · gohugoio/hugo · GitHub, which seems relevant but not actually working for my usecase.
If I add a ~30 second sleep between my file manipulations and hugo serve that seems to be enough time for the events to stop. I also tried adding the content folder to the privacy list in Spotlight, as the comment mentions, but that isn’t a great solution for other users who will be building this site.
Hmm thats an interesting idea. I hadn’t considered that because I do some other pre-processing (generating frontmatter, renaming README.md → _index.md, mostly) after the files have moved. Unfortunately, the repo has grown organically and I’m trying to get Hugo introduced with as little friction as possible, which is why I’m attempting to do these things on the fly. If I were to change the files in-place, and then mount them, I’m not sure if that would create more confusion/be more complicated.
Based on the hugo serve -v logs, I don’t see any other non-chmod events and a rebuild still gets triggered. See this Pastebin with the logs captured during serving.
As for not recommended, I agree, but organizational inertia is a hell of a thing.
Yea, you are right; we have a logic that detects “mass edits” (that logic also includes CHMOD) which schedules a full rebuild after 4 seconds. That logic could be changed, of course, but organizational inertia is a hell of a thing.
Does that same detection happen if hugo serve is run after the mass edit? Is Hugo just catching the tail end of the mass edits and that is enough to trigger the rebuild?