diff --git a/app/controllers/resque/queues/status_controller.rb b/app/controllers/resque/queues/status_controller.rb index 8e3eaf6..a2ccc84 100644 --- a/app/controllers/resque/queues/status_controller.rb +++ b/app/controllers/resque/queues/status_controller.rb @@ -9,10 +9,10 @@ def show age(params['queue']) when 'size' size(params['queue']) - when 'size_threshold' - Resque.queues_info.size_threshold(params.fetch('queue')) - when 'age_threshold' - Resque.queues_info.age_threshold(params.fetch('queue')) + when 'threshold_size' + Resque.queues_info.threshold_size(params.fetch('queue')) + when 'threshold_age' + Resque.queues_info.threshold_age(params.fetch('queue')) else 0 end.to_s diff --git a/lib/resque/integration/queues_info.rb b/lib/resque/integration/queues_info.rb index c2e7498..17f790d 100644 --- a/lib/resque/integration/queues_info.rb +++ b/lib/resque/integration/queues_info.rb @@ -20,7 +20,7 @@ def age_overall return 0 if job.nil? || max_time.nil? - max_time >= age_threshold(job['queue']) ? max_time : 0 + max_time >= threshold_age(job['queue']) ? max_time : 0 end def size_for_queue(queue = nil) @@ -32,14 +32,14 @@ def size_overall [queue, Resque.size(queue).to_i] end.max_by(&:last) - size >= size_threshold(queue) ? size : 0 + size >= threshold_size(queue) ? size : 0 end - def size_threshold(queue) + def threshold_size(queue) (@queues[queue] || @defaults)['max_size'] end - def age_threshold(queue) + def threshold_age(queue) (@queues[queue] || @defaults)['max_age'] end diff --git a/spec/resque/integration/queues_info_spec.rb b/spec/resque/integration/queues_info_spec.rb index b0f08b4..57e3cbf 100644 --- a/spec/resque/integration/queues_info_spec.rb +++ b/spec/resque/integration/queues_info_spec.rb @@ -189,7 +189,7 @@ let(:queue_name) { 'first' } it 'returns threshold for age' do - expect(queue_info.age_threshold(queue_name)).to eq 20 + expect(queue_info.threshold_age(queue_name)).to eq 20 end end @@ -197,7 +197,7 @@ let(:queue_name) { 'second' } it 'returns default threshold' do - expect(queue_info.age_threshold(queue_name)).to eq 10 + expect(queue_info.threshold_age(queue_name)).to eq 10 end end end @@ -207,7 +207,7 @@ let(:queue_name) { 'first' } it 'returns threshold for size' do - expect(queue_info.size_threshold(queue_name)).to eq 100 + expect(queue_info.threshold_size(queue_name)).to eq 100 end end @@ -215,7 +215,7 @@ let(:queue_name) { 'second' } it 'returns default threshold' do - expect(queue_info.size_threshold(queue_name)).to eq 10 + expect(queue_info.threshold_size(queue_name)).to eq 10 end end end