Skip to content

Commit

Permalink
Mark in-active files as fully read before skipping them
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilian Frank committed Mar 26, 2021
1 parent 51a88e1 commit ffb0f2c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/filewatch/read_mode/processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@ def process_active(watched_files)
logger.trace(__method__.to_s)
# Handles watched_files in the active state.
watched_files.each do |watched_file|
next unless watched_file.active?
unless watched_file.active?
if @settings.exit_after_read
# in-active files have been read completly in a previous run
# we need to mark them or the pipeline will not end
common_detach_when_allread(watched_file)
end
next
end

begin
restat(watched_file)
Expand Down Expand Up @@ -99,7 +106,7 @@ def process_active(watched_files)

def common_detach_when_allread(watched_file)
watched_file.unwatch
watched_file.listener.reading_completed
watched_file.listener.reading_completed unless watched_file.listener.nil?
add_deletable_path watched_file.path
logger.trace? && logger.trace("whole file read, removing from collection", :path => watched_file.path)
end
Expand Down

0 comments on commit ffb0f2c

Please sign in to comment.