Skip to content

Commit

Permalink
Merge 043f20d into 8d85b4c
Browse files Browse the repository at this point in the history
  • Loading branch information
WoolenWang committed Mar 2, 2019
2 parents 8d85b4c + 043f20d commit 223a7d5
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions lib/listen/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,30 @@ def _fast_unset_path(dirname, basename)
end
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)
def _fast_build_dir(remaining_, symlink_detector_)
thr_arr = []
5.times do
thr_arr << Thread.new(remaining_, symlink_detector_) 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 223a7d5

Please sign in to comment.