Rescan only if instance loaded

This commit is contained in:
Leeingnyo 2021-09-12 01:26:02 +09:00
parent 80e13abc4a
commit e6214ddc5d

View File

@ -29,16 +29,19 @@ class Library
zip_file.close zip_file.close
return return
end end
is_loaded = false
begin begin
instance_file.open do |content| instance_file.open do |content|
@@default = Library.from_yaml content @@default = Library.from_yaml content
end end
is_loaded = true
rescue e rescue e
Logger.error e Logger.error e
end end
zip_file.close zip_file.close
if is_loaded
spawn do spawn do
start = Time.local start = Time.local
Library.default.scan Library.default.scan
@ -47,6 +50,7 @@ class Library
in #{ms}ms" in #{ms}ms"
end end
end end
end
def initialize def initialize
register_mime_types register_mime_types