-
Notifications
You must be signed in to change notification settings - Fork 3
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
bug: WRITE events are missed on Mac OS arm64 #6
Comments
Actually, I can't confirm the behavior since I have no that machine but just tested it with my Linux box. With the current code, the event sequence is as the following: When
The sequence is mostly fine except why the event is not When I removed those two lines ( When
For some reason, an additional With this test, I guess the For the behavior on MacOS arm64, it seems like Still, this is not a perfect solution but could be fine. Open for any opinions! |
Hi @saurori, What do you think about this patch? Since we cannot be 100% sure of the side effects of Once you confirm this approach on your OS and architecture, I will apply it to the next release soon. --- a/refresh/manager.go
+++ b/refresh/manager.go
@@ -53,9 +53,9 @@ func (r *Manager) Start() error {
case event := <-w.Events():
if event.Op != fsnotify.Chmod {
go r.build(event)
+ w.Remove(event.Name)
+ w.Add(event.Name)
}
- w.Remove(event.Name)
- w.Add(event.Name)
case <-r.context.Done():
break LoopRebuilder
} |
Tested with vscode again. With vscode, the save operation made two Mostly the second
The patch will be simply: --- a/refresh/manager.go
+++ b/refresh/manager.go
@@ -54,8 +54,6 @@ func (r *Manager) Start() error {
if event.Op != fsnotify.Chmod {
go r.build(event)
}
- w.Remove(event.Name)
- w.Add(event.Name)
case <-r.context.Done():
break LoopRebuilder
} |
@sio4 Looks good. I know it's difficult to test this since |
Hi @saurori, I was not able to make enough time recently but just (partially) resumed working on releasing Pop, Core, and CLI one by one due to their dependency chain. |
(It was applied and released as CLI v0.18.13) |
Description
Description
On Mac OS arm64 (14" 2021 Macbook Pro, M1 Pro),
fsnotify
sends two events when a file changes:CHMOD
andWRITE
. When the first eventCHMOD
comes in,w.Remove(event.Name)
andw.Add(event.Name)
are called here. This causes the secondWRITE
event to sometimes not trigger a build (possibly some race condition). I am not sure what is causing this, and it is not clear why the Remove and Add is necessary on each event. If the Remove() and Add() lines are commented out, the build refreshes and works as expected when a file changes, every time.Expected Behavior
build()
is called every time a file changes.Actual Behavior
When a file changes, only some times a build will trigger.
To Reproduce
buffalo new
buffalo dev
actions/
multiple times and watch for rebuilds of the app.Additional Context
Details
The text was updated successfully, but these errors were encountered: