-
Notifications
You must be signed in to change notification settings - Fork 102
Move filewatch lib here, refactor and add new features. #171
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
Merged
guyboertje
merged 21 commits into
logstash-plugins:master
from
guyboertje:feature/import-filewatch
Apr 24, 2018
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1e9e831
Pull filewatch library changes into the file input.
18cdb08
housekeeping and one last test case.
192eb6a
more housekeeping
282435c
keep gradle wrapper
8f0c921
switch settings from OPTS constant to instance level vars
756efbc
adjust spec to kick travis into gear
25b3d3d
fix failing travis test and rename/limit state_history to recent_states
3c0fb03
rename constant, prevent warning in travis.
f542d68
attempt to fix travis failures, need feedback
d6c60d5
make tailing use striped read parallelism
d12ec45
6.X/master fix in-order event expectations when out-of-order events a…
889b636
remove expired sincedb_collection values from memory as well as disk
9b31c03
Updates from the review process.
d97a6cf
Some typos fixed
b8671dc
updates per latest review
f3e858b
change gemspec version to 5.0.0
76b68db
Change license text in gemspec. Handle Java close methods better.
1329ecc
oops, method was in the wrong place.
200cd86
Change method name plus log warning.
da9e968
add exception details
12c1854
use "normal" exception logging :-)
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ def handle_specifically(watched_file) | |
end | ||
watched_file.listener.eof | ||
rescue ZipException => e | ||
logger.error("ReadZipFile: cannot decompress the gzip file at path: #{watched_file.path}") | ||
logger.error("Cannot decompress the gzip file at path: #{watched_file.path}") | ||
watched_file.listener.error | ||
else | ||
sincedb_collection.store_last_read(watched_file.sincedb_key, watched_file.last_stat_size) | ||
|
@@ -36,21 +36,21 @@ def handle_specifically(watched_file) | |
watched_file.unwatch | ||
ensure | ||
# rescue each close individually so all close attempts are tried | ||
close_java_closeable(buffered) unless buffered.nil? | ||
close_java_closeable(decoder) unless decoder.nil? | ||
close_java_closeable(gzip_stream) unless gzip_stream.nil? | ||
close_java_closeable(file_stream) unless file_stream.nil? | ||
close_and_ignore_ioexception(buffered) unless buffered.nil? | ||
close_and_ignore_ioexception(decoder) unless decoder.nil? | ||
close_and_ignore_ioexception(gzip_stream) unless gzip_stream.nil? | ||
close_and_ignore_ioexception(file_stream) unless file_stream.nil? | ||
end | ||
sincedb_collection.unset_watched_file(watched_file) | ||
end | ||
|
||
private | ||
|
||
def close_java_closeable(closeable) | ||
def close_and_ignore_ioexception(closeable) | ||
begin | ||
closeable.close | ||
rescue Exception # IOException can be thrown by any of the Java classes that implement the Closable interface. | ||
# ignore this | ||
logger.warn("Ignoring an IOException when closing an instance of #{closeable.class.name}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: add the exception detail too? |
||
end | ||
end | ||
end | ||
|
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.
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.
👍