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.
This fixes a situation when logs are rotated via movement.
In the current code, (4) cleans up the
done
channel but then removes the directory watch and exits without instructing theInotifyTracker::run
to complete the cleanup via theremoveWatch
method. This results in the event channel for the file not being cleaned up. It's not a problem in itself, but then in (5),addWatch
uses the presence of the event channel to decide whether initialize both events anddone
channel. As the event channel is still present, thedone
channel is not initialized. Subsequently, absence of thedone
channel preventssendEvents
from forwarding fsnotify events to clients.This change makes a separate check for presence of the of the
done
channel in order to initialize it. The changes in the test introduce stricter checks: without them the test hangs and is subsequently terminated as lines are not being delivered to the reader.