9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/kaya/background_jobs/workers/garbage_cleaner.rb', line 9
def perform
Kaya::Support::Configuration.get
Kaya::Database::MongoConnector.new(Kaya::Support::Configuration.db_connection_data)
get_present_output_files = Dir["#{Dir.pwd}/kaya/temp/*.out"].select{|file| file.start_with? "kaya_co_"}
get_present_report_files = Dir["#{Dir.pwd}/kaya/temp/*.html"].select{|file| file.start_with? "kaya_report_"}
get_present_output_files.each do |output_file|
if result = Kaya::Results::Result.get(output_file.scan(/\d+/).first)
File.delete("#{Dir.pwd}/kaya/temp/#{output_file}") if result.finished?
end
end
get_present_report_files.each do |report_file|
if result = Kaya::Results::Result.get(report_file.scan(/\d+/).first)
File.delete("#{Dir.pwd}/kaya/temp/#{report_file}") if result.finished?
end
end
end
|