-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
trigger fsnotify by a meaningful write to the config file #3492
trigger fsnotify by a meaningful write to the config file #3492
Conversation
35fd51c
to
63088ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still not sure how WriteString
does what Close()
doesn't.
discovery/file/file_test.go
Outdated
retry: | ||
for { | ||
select { | ||
case <-timeout: | ||
if expect { | ||
t.Fatalf("Expected new target group but got none") | ||
} else { | ||
// invalid type fsd should always broken down. | ||
// Invalid type fsd should always broken down. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The grammar is off here :) Invalid type fsd should always break down.
close(fileReady) | ||
<-drainReady | ||
newf.Close() | ||
newf.WriteString(" ") // One last meaningless write to trigger fsnotify and a new loop of the discovery service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newf.Sync()
would do the trick no? And why doesn't Close()
work here, it also syncs the data to disk, AFAIK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried newf.Sync()
and it doesn't trigger a new fsnotify signal
Sorry. Reading it again, the initial writes are drained out and we need to trigger a new FSD loop for the changes to be picked up. 👍 for the PR. |
63088ad
to
c4471f4
Compare
c4471f4
to
178e50a
Compare
@grobie PTAL |
fixes #3462