mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 10:55:30 -04:00
Apply yield forcely
This commit is contained in:
parent
2e09efbd62
commit
670cf54957
@ -115,6 +115,7 @@ class Title
|
|||||||
previous_entries_size = @entries.size
|
previous_entries_size = @entries.size
|
||||||
@entries.select! do |entry|
|
@entries.select! do |entry|
|
||||||
existence = File.exists? entry.zip_path
|
existence = File.exists? entry.zip_path
|
||||||
|
yield_process_file context
|
||||||
context["deleted_entry_ids"] << entry.id unless existence
|
context["deleted_entry_ids"] << entry.id unless existence
|
||||||
existence
|
existence
|
||||||
end
|
end
|
||||||
|
@ -140,3 +140,8 @@ alias ExamineContext = NamedTuple(
|
|||||||
deleted_title_ids: Array(String),
|
deleted_title_ids: Array(String),
|
||||||
deleted_entry_ids: Array(String)
|
deleted_entry_ids: Array(String)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def yield_process_file(context : ExamineContext)
|
||||||
|
context["file_count"] += 1
|
||||||
|
Fiber.yield if context["file_count"] % 1000 == 0
|
||||||
|
end
|
||||||
|
@ -56,6 +56,7 @@ class Dir
|
|||||||
# directories)
|
# directories)
|
||||||
def self.contents_signature(dirname, cache = {} of String => String) : String
|
def self.contents_signature(dirname, cache = {} of String => String) : String
|
||||||
return cache[dirname] if !cache.nil? && cache[dirname]?
|
return cache[dirname] if !cache.nil? && cache[dirname]?
|
||||||
|
Fiber.yield # Yield first
|
||||||
signatures = [] of String
|
signatures = [] of String
|
||||||
self.open dirname do |dir|
|
self.open dirname do |dir|
|
||||||
dir.entries.sort.each do |fn|
|
dir.entries.sort.each do |fn|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user