Skip to content
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

Mark in-active files as fully read before skipping them #289

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 and watched_file.all_read?
# in-active files that have been read completly in a previous run
# need to be marked as such 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