Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be less aggressive with CHMOD filesystem events #2305

Merged
merged 1 commit into from
Jul 26, 2016

Conversation

melo
Copy link
Contributor

@melo melo commented Jul 26, 2016

On 4679fbe, rebuild was disabled on CHMOD filesystem events, but the code is overly aggressive.

In some situations, specially with older Mac's (using a Late 2008 Macbook), the events we receive might be aggregated. On my particular laptop, I get this events:

INFO: 2016/07/26 18:08:51 hugo.go:737: Received System Events: ["<path>": WRITE|CHMOD]

These events are ignored because the code only checks for Chmod. This commit fixes this by checking that the event is also not a Write or Create.

Related to #1587.


This is my first contribution to any Go project, so please forgive any Go-newbiness going on. Any comments are appreciated.

I also don't know how to write tests about this. I don't see a hugo_test.go and frankly I don't know how to simulate filesystem events to reproduce this. I do know that Hugo now rebuilds correctly on these events on my slow Mac :). Help is appreciated here.

Thank you,

On 4679fbe, rebuild was disabled on
CHMOD filesystem events, but the code is overly aggressive.

In some situations, specially with older Mac's (using a Late 2008
Macbook), the events we receive might be aggregated. On my
particular laptop, I get this events:

    INFO: 2016/07/26 18:08:51 hugo.go:737: Received System Events: ["<path>": WRITE|CHMOD]

These events are ignored because the code only checks for Chmod. This
commit fixes this by checking that the event is also not a Write or Create.

Related to gohugoio#1587.
@bep
Copy link
Member

bep commented Jul 26, 2016

Don't worry about the tests -- I know how painful it is to write file system events tests (see https://github.com/fsnotify/fsnotify/blob/master/integration_darwin_test.go#L22 for a test I wrote to simulate atomic writes on OS X); Hugo's problem is that it must support lots of editors, and it is impossible (or very hard) to test them all ...

@bep bep merged commit 3e1b579 into gohugoio:master Jul 26, 2016
@melo
Copy link
Contributor Author

melo commented Jul 27, 2016

Thanks!

@melo melo deleted the fix-chmod-slow-macs branch July 27, 2016 08:49
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants