Class: KMDB::Jobs::FindFiles
- Defined in:
- lib/kmdb/jobs/find_files.rb
Overview
Detects a batch up new revision files in S3 and adds Dumpfiles for them.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.perform ⇒ Object
14 15 16 |
# File 'lib/kmdb/jobs/find_files.rb', line 14 def self.perform new.work end |
Instance Method Details
#work ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/kmdb/jobs/find_files.rb', line 18 def work lookahead = Integer(ENV.fetch('KMDB_REVISION_LOOKAHEAD', 10)) start_at = Dumpfile.maximum(:revision) || Integer(ENV.fetch('KMDB_MIN_REVISION', 1)) start_at.upto(start_at + lookahead).map do |revision| json_file = JsonFile.new(revision) next unless json_file.exist? Resque.enqueue(ParseFile, json_file.revision) end end |