Skip to content

Commit

Permalink
Merge pull request #2063 from t-osakada/fix-rescue-error-enoent
Browse files Browse the repository at this point in the history
fix to rescue Errno::ENOENT for File.mtime()
  • Loading branch information
repeatedly authored Jul 10, 2018
2 parents f0a1af1 + 643d279 commit 7cb713b
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,24 @@ def expand_paths
path = date.strftime(path)
if path.include?('*')
paths += Dir.glob(path).select { |p|
is_file = !File.directory?(p)
if File.readable?(p) && is_file
if @limit_recently_modified && File.mtime(p) < (date - @limit_recently_modified)
false
begin
is_file = !File.directory?(p)
if File.readable?(p) && is_file
if @limit_recently_modified && File.mtime(p) < (date - @limit_recently_modified)
false
else
true
end
else
true
end
else
if is_file
unless @ignore_list.include?(path)
log.warn "#{p} unreadable. It is excluded and would be examined next time."
@ignore_list << path if @ignore_repeated_permission_error
if is_file
unless @ignore_list.include?(path)
log.warn "#{p} unreadable. It is excluded and would be examined next time."
@ignore_list << path if @ignore_repeated_permission_error
end
end
false
end
rescue Errno::ENOENT
false
end
}
Expand Down

0 comments on commit 7cb713b

Please sign in to comment.