Class: Resque::Integration::QueuesInfo::Age
- Inherits:
-
Object
- Object
- Resque::Integration::QueuesInfo::Age
- Defined in:
- lib/resque/integration/queues_info/age.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Age
constructor
A new instance of Age.
- #overall ⇒ Object
- #threshold(queue) ⇒ Object
- #time(queue) ⇒ Object
Constructor Details
#initialize(config) ⇒ Age
Returns a new instance of Age.
5 6 7 |
# File 'lib/resque/integration/queues_info/age.rb', line 5 def initialize(config) @config = config end |
Instance Method Details
#overall ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/resque/integration/queues_info/age.rb', line 22 def overall from_time = Time.now.utc max_secs = 0 jobs.each do |job| next unless job['queue'] job_secs = seconds_for(job, from_time) next if job_secs < threshold(job['queue']) max_secs = job_secs if job_secs > max_secs end max_secs end |
#threshold(queue) ⇒ Object
37 38 39 |
# File 'lib/resque/integration/queues_info/age.rb', line 37 def threshold(queue) @config.max_age(queue) end |
#time(queue) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/resque/integration/queues_info/age.rb', line 9 def time(queue) from_time = Time.now.utc max_secs = 0 jobs.each do |job| next unless job['queue'] == queue job_secs = seconds_for(job, from_time) max_secs = job_secs if job_secs > max_secs end max_secs end |