diff options
author | Nat Lasseter <nat.lasseter@york.ac.uk> | 2020-03-16 10:15:21 +0000 |
---|---|---|
committer | Nat Lasseter <nat.lasseter@york.ac.uk> | 2020-03-16 10:15:21 +0000 |
commit | 666ea91e473554acabe6f6c3477eb915e70a7538 (patch) | |
tree | 2f245df6a494c63f6a829f4729552939ce0effdd /lib/longboat/jobs.rb | |
parent | 58758e907801e332f5e80b4f2fed5a50f080fec1 (diff) |
Refactor: renamed jobs to raiders, becaus pun, and jobs is confusing given the intended application of longboat by the original authors.
Diffstat (limited to 'lib/longboat/jobs.rb')
-rw-r--r-- | lib/longboat/jobs.rb | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/lib/longboat/jobs.rb b/lib/longboat/jobs.rb deleted file mode 100644 index 5166993..0000000 --- a/lib/longboat/jobs.rb +++ /dev/null @@ -1,49 +0,0 @@ -module Longboat - class Jobs - def initialize(collector, config) - @collector = collector - @jobs = [] - @config = config - - @config[:jobs_path].each do |dir| - next unless Dir.exist?(dir) - - Dir.entries(dir).each do |file| - next if file =~ /^\./ - - reqname = File.basename(file, ".rb") - cname = reqname.split('_').map(&:capitalize).join - - require "jobs/#{reqname}" - @jobs << Kernel.const_get(cname).new(@collector, job_config) - end - end - end - - def collect! - @jobs.each(&:run) - end - - def collect_every(time = @config[:collect_every], async = true) - if async - Thread.new do - loop do - collect! - sleep(time) - end - end - else - loop do - collect! - sleep(time) - end - end - end - - private - - def job_config - @config.slice(:collect_every, :metric_prefix) - end - end -end |