Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Send events before adding watchers in traversePluginDir #75110
Send events before adding watchers in traversePluginDir #75110
Changes from all commits
817c9ca
f564557
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Looking at the implementation of handleCreateEvent, I think it's more direct to just do:
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.
Not sure if I follow, do you mean inside
handleCreateEvent
? If so, then it wouldn't callhandlePluginRegistration
... or am I missing somehting?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 mean "handle create event" doesn't really seem like what this is doing, unless I'm not following the control flow. If you look at what handle create event is doing, the snippet I commented above is all that gets hit in that function, so I'm suggesting to just inline that piece here.
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.
Ah, OK... I understand now...
This part of the code creates "synthetic create events" if we find a socket file. Then we "handle" this event right here (as opposed to sending it to a processing goroutine like it was before).
Since we're dealing with a socket file, we don't really want to
traversePluginDir()
it, but instead we want to register the plugin that's listening to this unix domain socket file (i.e.,handlePluginRegistration()
).However, we also need to make sure that we ignore black-listed directories (like you pointed in the snippet above) and files prefixed with a "."; this would do it:
IMO
handleCreateEvent()
looks like would be a better fit though (since we're almost re-implementing it in-line).Does this make sense?
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.
Ah, sorry, I completely misread what
handleCreateEvent
was doing.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.
Shouldn't the err be returned, in the same way error is returned for mode.IsDir() case ?
I created PR #77244
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.
alternatively, you can just do this serially at the end of the test and rely on the whole test timing out for the failure condition.
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.
Since we're processing plugins serially now,
newWatcherWithHandler
below would block forever trying to write to the event/registration channels. This goroutine prevents that by receiving info from these channels beforehand.