lib/daengine/digital_asset_processor.rb in daengine-0.4.0.4 vs lib/daengine/digital_asset_processor.rb in daengine-0.4.5

- old
+ new

@@ -24,22 +24,26 @@ deploy_files = Dir.entries(path).select { |f| File.file?("#{path}/#{f}") and File.mtime("#{path}/#{f}") > @@last_read_time }.sort_by { |f| File.mtime("#{path}/#{f}") } if deploy_files.empty? - Daengine.log("WARN: DigitalAssetProcessor: No digital asset deployment files found to process under #{path}", "warn") + Daengine.log("DigitalAssetProcessor: No digital asset deployment files found to process under #{path}", "warn") else Daengine.log("DigitalAssetProcessor: Reading digital asset deployment files from #{path}", "info") deploy_files.each do |filename| - #parse the file and add metadata content to database. - file = File.expand_path(filename, path) - Daengine.log("DigitalAssetProcessor: Processing file #{filename} --- #{File.mtime(file)}", "info") - open_file = File.open(file, 'rb') - Daengine::TeamsiteMetadataParser.parse_tuple_file(open_file, last_run_time) - Daengine.log("DigitalAssetProcessor: Finished processing #{filename}", "info") - @@last_read_time = File.mtime(file) + 1.second - self.save_last_read_time - Daengine.log("DigitalAssetProcessor: Last process time set to #{@@last_read_time}", "info") + begin + #parse the file and add metadata content to database. + file = File.expand_path(filename, path) + Daengine.log("DigitalAssetProcessor: Processing file #{filename} --- #{File.mtime(file)}", "info") + open_file = File.open(file, 'rb') + Daengine::TeamsiteMetadataParser.parse_tuple_file(open_file, last_run_time) + Daengine.log("DigitalAssetProcessor: Finished processing #{filename}", "info") + @@last_read_time = File.mtime(file) + 1.second + self.save_last_read_time + Daengine.log("DigitalAssetProcessor: Last process time set to #{@@last_read_time}", "info") + rescue + Daengine.log("Unable to process file #{filename}, #{$!.message}", "error") + end end end rescue Errno::EEXIST Daengine.log("DigitalAssetProcessor: Already in progress. Lockfile exists at #{lockfile_name}. Aborting!", "error") \ No newline at end of file