Skip to content

Commit

Permalink
feat: добавит пороговые значения в информацию об очередях
Browse files Browse the repository at this point in the history
  • Loading branch information
folklore committed Mar 13, 2017
1 parent a34191f commit 073c77d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/resque/integration/queues_info/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ def channel(queue)
end

def data
@data ||= @queues.map do |k, v|
@data ||= @queues.map do |queue_name, _queue_params|
{
"{#QUEUE}" => k
'{#QUEUE}' => queue_name,
'{#THRESHOLD_AGE}' => max_age(queue_name),
'{#THRESHOLD_SIZE}' => max_size(queue_name),
'{#THRESHOLD_FAILURES_PER_5M}' => max_failures_count(queue_name, '5m'),
'{#THRESHOLD_FAILURES_PER_1H}' => max_failures_count(queue_name, '1h'),
'{#CHANNEL}' => channel(queue_name)
}
end
end
Expand Down
31 changes: 31 additions & 0 deletions spec/resque/integration/queues_info_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,35 @@
expect(queue_info.threshold_failures_count(third_queue_name, '1h')).to eq 70
end
end

describe '#data' do
it do
expect(queue_info.data).to eq [
{
'{#QUEUE}' => 'first',
'{#THRESHOLD_AGE}' => 20,
'{#THRESHOLD_SIZE}' => 100,
'{#THRESHOLD_FAILURES_PER_5M}' => 15,
'{#THRESHOLD_FAILURES_PER_1H}' => 90,
'{#CHANNEL}' => 'first'
},
{
'{#QUEUE}' => 'third',
'{#THRESHOLD_AGE}' => 30,
'{#THRESHOLD_SIZE}' => 100,
'{#THRESHOLD_FAILURES_PER_5M}' => 15,
'{#THRESHOLD_FAILURES_PER_1H}' => 70,
'{#CHANNEL}' => 'first'
},
{
'{#QUEUE}' => 'second_queue',
'{#THRESHOLD_AGE}' => nil,
'{#THRESHOLD_SIZE}' => nil,
'{#THRESHOLD_FAILURES_PER_5M}' => nil,
'{#THRESHOLD_FAILURES_PER_1H}' => nil,
'{#CHANNEL}' => 'first second'
}
]
end
end
end

0 comments on commit 073c77d

Please sign in to comment.