11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/daengine/taxonomy_processor.rb', line 11
def self.process_taxonomy_file
file = Daengine.config[:taxonomy_xml_filepath]
raise "ERROR: TaxonomyProcessor: Invalid taxonomy_xml_filepath provided. Unable to read from #{file}" unless File::exist?(file)
time = self.read_last_process_time
if not time.blank?
@@last_read_time = time
end
Daengine.log("TaxonomyProcessor: Last process time was #{@@last_read_time}", "info")
if (File.mtime(file) > @@last_read_time)
Daengine.log("TaxonomyProcessor: Processing file #{file} --- #{File.mtime(file)}", "info")
open_file = File.open(file, 'rb')
Daengine::TaxonomyParser.parse_taxonomy_file(open_file)
Daengine.log("TaxonomyProcessor: Finished processing #{file}", "info")
@@last_read_time = File.mtime(file) + 1.second
self.save_last_read_time
Daengine.log("TaxonomyProcessor: Last process time set to #{@@last_read_time}", "info")
else
Daengine.log("TaxonomyProcessor: No updates to taxonomy since last process task.", "info")
end
end
|