-
Notifications
You must be signed in to change notification settings - Fork 109
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
Run Filewatchers triggerfunction only once on changes on the watched file #3752
base: main
Are you sure you want to change the base?
Run Filewatchers triggerfunction only once on changes on the watched file #3752
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3752 +/- ##
============================================
+ Coverage 52.44% 52.48% +0.04%
- Complexity 874 877 +3
============================================
Files 342 342
Lines 21415 21431 +16
Branches 284 286 +2
============================================
+ Hits 11231 11248 +17
Misses 9274 9274
+ Partials 910 909 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Good catch @creydr !
/lgtm
/approve
@@ -42,13 +42,13 @@ public void tearDown() throws Exception { | |||
Files.deleteIfExists(tempFile.toPath()); | |||
} | |||
|
|||
@Test | |||
@RepeatedTest(20) |
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.
💯
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: creydr, pierDipi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I guess some formatting issues on the build test |
/lgtm |
Do we want to backport this? |
@creydr: The following tests failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/hold
|
data-plane/core/src/main/java/dev/knative/eventing/kafka/broker/core/file/FileWatcher.java
Show resolved
Hide resolved
I think we maybe need to check if the file is empty somewhere in Lines 69 to 72 in 551691c
|
This PR has some issues with symlinks ATM. I have a WIP change for it but need to recheck on it... |
We have seen the Filewatcher unit tests being flaky with:
This is, as the MODIFY event can get send twice (once for update on the file content and once for update on the files modification date. See https://stackoverflow.com/a/25221600):
This can be fixed by either a
Thread.sleep()
right after thewatcher.take()
, or by checking the files modification date and only calling the trigger function if it got updated.This is addressed in this PR. In addition, the trigger function is only called, when the watched file got updated (the filewatcher watches a directory and notifies on changes on all files): 94f3210