Skip to content

Commit

Permalink
Merge 1849e30 into 8d85b4c
Browse files Browse the repository at this point in the history
  • Loading branch information
WoolenWang committed Mar 1, 2019
2 parents 8d85b4c + 1849e30 commit 4f63be3
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions lib/listen/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,29 @@ def _fast_unset_path(dirname, basename)
end

def _fast_build_dir(remaining, symlink_detector)
entry = remaining.pop
children = entry.children # NOTE: children() implicitly tests if dir
symlink_detector.verify_unwatched!(entry)
children.each { |child| remaining << child }
add_dir(entry.record_dir_key)
rescue Errno::ENOTDIR
_fast_try_file(entry)
rescue SystemCallError, SymlinkDetector::Error
_fast_unset_path(entry.relative, entry.name)
thr_arr = []
5.times do
thr_arr << Thread.new(rm, sd) do |remaining, symlink_detector|
begin
entry = remaining.pop(true)
rescue Exception
return
end
begin
children = entry.children # NOTE: children() implicitly tests if dir
symlink_detector.verify_unwatched!(entry)
children.each {|child| remaining << child}
add_dir(entry.record_dir_key)
rescue Errno::ENOTDIR
_fast_try_file(entry)
rescue SystemCallError, SymlinkDetector::Error
_fast_unset_path(entry.relative, entry.name)
end
end
end
thr_arr.each do |one|
one.join
end
end

def _fast_try_file(entry)
Expand Down

0 comments on commit 4f63be3

Please sign in to comment.