mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 10:55:30 -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
|
end
|
||||||
|
|
||||||
class YieldCounter
|
class YieldCounter
|
||||||
setter threshold : Int32
|
@file_count : UInt32
|
||||||
|
|
||||||
def initialize(@threshold : Int32)
|
def initialize(@threshold : Int32)
|
||||||
@file_count = 0
|
@file_count = 0
|
||||||
@ -143,7 +143,7 @@ class YieldCounter
|
|||||||
|
|
||||||
def count_and_yield
|
def count_and_yield
|
||||||
@file_count += 1
|
@file_count += 1
|
||||||
Fiber.yield if @file_count % @threshold == 0
|
Fiber.yield if @threshold > 0 && @file_count % @threshold == 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class Dir
|
|||||||
next if fn.starts_with? "."
|
next if fn.starts_with? "."
|
||||||
path = File.join dirname, fn
|
path = File.join dirname, fn
|
||||||
if File.directory? path
|
if File.directory? path
|
||||||
signatures << Dir.contents_signature path, cache
|
signatures << Dir.contents_signature path, cache, counter
|
||||||
else
|
else
|
||||||
# Only add its signature value to `signatures` when it is a
|
# Only add its signature value to `signatures` when it is a
|
||||||
# supported file
|
# supported file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user