mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 02:45:29 -04:00
Pass a counter to recursive calls, Ignore negative threshold
This commit is contained in:
parent
70ab198a33
commit
9769e760a0
@ -135,7 +135,7 @@ class TitleInfo
|
||||
end
|
||||
|
||||
class YieldCounter
|
||||
setter threshold : Int32
|
||||
@file_count : UInt32
|
||||
|
||||
def initialize(@threshold : Int32)
|
||||
@file_count = 0
|
||||
@ -143,7 +143,7 @@ class YieldCounter
|
||||
|
||||
def count_and_yield
|
||||
@file_count += 1
|
||||
Fiber.yield if @file_count % @threshold == 0
|
||||
Fiber.yield if @threshold > 0 && @file_count % @threshold == 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -65,7 +65,7 @@ class Dir
|
||||
next if fn.starts_with? "."
|
||||
path = File.join dirname, fn
|
||||
if File.directory? path
|
||||
signatures << Dir.contents_signature path, cache
|
||||
signatures << Dir.contents_signature path, cache, counter
|
||||
else
|
||||
# Only add its signature value to `signatures` when it is a
|
||||
# supported file
|
||||
|
Loading…
x
Reference in New Issue
Block a user