Skip to content

Commit a255120

Browse files
committed
fix to rescue Errno::ENOENT for File.mtime()
1 parent f0a1af1 commit a255120

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

lib/fluent/plugin/in_tail.rb

+15-11
Original file line numberDiff line numberDiff line change
@@ -216,20 +216,24 @@ def expand_paths
216216
path = date.strftime(path)
217217
if path.include?('*')
218218
paths += Dir.glob(path).select { |p|
219-
is_file = !File.directory?(p)
220-
if File.readable?(p) && is_file
221-
if @limit_recently_modified && File.mtime(p) < (date - @limit_recently_modified)
222-
false
219+
begin
220+
is_file = !File.directory?(p)
221+
if File.readable?(p) && is_file
222+
if @limit_recently_modified && File.mtime(p) < (date - @limit_recently_modified)
223+
false
224+
else
225+
true
226+
end
223227
else
224-
true
225-
end
226-
else
227-
if is_file
228-
unless @ignore_list.include?(path)
229-
log.warn "#{p} unreadable. It is excluded and would be examined next time."
230-
@ignore_list << path if @ignore_repeated_permission_error
228+
if is_file
229+
unless @ignore_list.include?(path)
230+
log.warn "#{p} unreadable. It is excluded and would be examined next time."
231+
@ignore_list << path if @ignore_repeated_permission_error
232+
end
231233
end
234+
false
232235
end
236+
rescue Errno::ENOENT
233237
false
234238
end
235239
}

0 commit comments

Comments
 (0)