lib/filewatch/watched_files_collection.rb in logstash-input-file-4.1.17 vs lib/filewatch/watched_files_collection.rb in logstash-input-file-4.1.18
- old
+ new
@@ -13,16 +13,20 @@
def add(watched_file)
@files << watched_file
@sort_method.call
end
- def delete(paths)
- Array(paths).each do |f|
- index = @pointers.delete(f)
- @files.delete_at(index)
- refresh_pointers
+ def remove_paths(paths)
+ removed_files = Array(paths).map do |path|
+ index = @pointers.delete(path)
+ if index
+ watched_file = @files.delete_at(index)
+ refresh_pointers
+ watched_file
+ end
end
@sort_method.call
+ removed_files
end
def close_all
@files.each(&:file_close)
end