sidekiq-queue-stats 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51e57c307b05076c0fbff272ff625e063eb14365
4
- data.tar.gz: 106453857a501e1a0d20a395b3ca3e7573ede51f
3
+ metadata.gz: dbd643a40085110519af1f51bbefae8467022412
4
+ data.tar.gz: 9b0138eb0d1ef8930aaf0be0e08b085a51557032
5
5
  SHA512:
6
- metadata.gz: 60d1d2482649a54b3204dda12cbbac5c31d72695c9a7a85edf934473526c2b5991792fd4a5d5a7134829c4fb85054b874a28e3d3cec7e07c6c671c1030504086
7
- data.tar.gz: 0de12313c8889f37d8af4311d7645b9b151b0e1fa2e6a772b485002d94f8f6638234287e495fbdbd4651654a1452f6ef76fc7aed9d2540a5d8403aceba951f16
6
+ metadata.gz: f6d04509c58906775525c538bc6d80e53da9acf0f15125ea23549b392fd46184141440e9636cc96307297fbb48ced3227e8b1877dd1939874b2efdcdce17bfd9
7
+ data.tar.gz: 28f942925b89a941b53f14dbd62841fa68e689ac1cb80d82e3a95f5da948699a1ac6598ddd1eee800e61cd34a9ddb37ba5cc58d0f7cf7400a4c387efaf156b88
@@ -9,6 +9,8 @@ require "sidekiq/queue_stats/version"
9
9
  require "sidekiq/queue_stats/web_extension"
10
10
 
11
11
  module Sidekiq
12
+ module QueueStats
13
+ end
12
14
  end
13
15
 
14
16
  if defined?(Sidekiq::Web)
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module QueueStats
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -9,8 +9,8 @@
9
9
  </button>
10
10
  <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
11
11
  <li><a href="?">All</a></li>
12
- <% @qs.each do |q| %>
13
- <li><a href=<%="?queue=#{q.downcase}"%>><%= q.capitalize %></a></li>
12
+ <% @queues_list.each do |q| %>
13
+ <li><a href=<%="?selected_queue=#{q.downcase}"%>><%= q.capitalize %></a></li>
14
14
  <% end %>
15
15
  </ul>
16
16
  </div>
@@ -19,9 +19,9 @@
19
19
 
20
20
 
21
21
  <%= csrf_tag if respond_to?(:csrf_tag) %>
22
- <% if params[:queue] %>
23
- <h4><%= @q.name.capitalize %></h4>
24
- <% if @wrks[@q.name].empty? %>
22
+ <% if params[:selected_queue] %>
23
+ <h4><%= @selected_queue.name.capitalize %></h4>
24
+ <% if @workers_count[@selected_queue.name].empty? %>
25
25
  <div class="alert alert-success">Nothing waiting in queue</div>
26
26
  <% else %>
27
27
  <table class="table table-striped table-bordered table-white">
@@ -31,7 +31,7 @@
31
31
  <th style="width: 150px">Count</th>
32
32
  </tr>
33
33
  </thead>
34
- <% @wrks[@q.name].each do |worker| %>
34
+ <% @workers_count[@selected_queue.name].each do |worker| %>
35
35
  <tr>
36
36
  <td><%=worker.first%></td>
37
37
  <td><%=worker.last%></td>
@@ -40,12 +40,12 @@
40
40
  </table>
41
41
  <% end %>
42
42
  <% else %>
43
- <% if @qs.empty? %>
43
+ <% if @queues_list.empty? %>
44
44
  <div class="alert alert-success">Nothing waiting in any queue</div>
45
45
  <% else %>
46
- <% @qs.each do |q| %>
46
+ <% @queues_list.each do |q| %>
47
47
  <h4><%= q.capitalize %></h4>
48
- <% if @wrks[q].empty? %>
48
+ <% if @workers_count[q].empty? %>
49
49
  <div class="alert alert-success">Nothing waiting in queue</div>
50
50
  <% else %>
51
51
  <table class="table table-striped table-bordered table-white">
@@ -55,7 +55,7 @@
55
55
  <th style="width: 150px">Count</th>
56
56
  </tr>
57
57
  </thead>
58
- <% @wrks[q].each do |worker| %>
58
+ <% @workers_count[q].each do |worker| %>
59
59
  <tr>
60
60
  <td><%=worker.first%></td>
61
61
  <td><%=worker.last%></td>
@@ -6,20 +6,21 @@ module QueueStats
6
6
  view_path = File.join(File.expand_path("..", __FILE__), "views")
7
7
 
8
8
  app.get "/queue_stats" do
9
- @qs = Sidekiq::Queue.all.map(&:name)
10
- @wrks = {}
9
+ @queues_list = Sidekiq::Queue.all.map(&:name)
10
+ @workers_count = {}
11
11
 
12
- if params[:queue]
13
- @q = params[:queue] ? Sidekiq::Queue.new(params[:queue]) : Sidekiq::Queue.new
14
- @wrks[@q.name] = Hash.new(0)
15
- @q.each do |job|
16
- @wrks[@q.name][job.klass] += 1
12
+ if params[:selected_queue]
13
+ @selected_queue = params[:selected_queue] ? Sidekiq::Queue.new(params[:selected_queue]) : Sidekiq::Queue.new
14
+ @workers_count[@selected_queue.name] = Hash.new(0)
15
+ @selected_queue.each do |job|
16
+ @workers_count[@selected_queue.name][job.klass] += 1
17
17
  end
18
18
  else
19
- Sidekiq::Queue.all.each do |q|
20
- @wrks[q.name] = Hash.new(0)
19
+ queues_list = Sidekiq::Queue.all
20
+ queues_list.each do |q|
21
+ @workers_count[q.name] = Hash.new(0)
21
22
  q.each do |job|
22
- @wrks[q.name][job.klass] += 1
23
+ @workers_count[q.name][job.klass] += 1
23
24
  end
24
25
  end
25
26
  end
@@ -11,7 +11,6 @@ module Sidekiq
11
11
 
12
12
  before do
13
13
  Sidekiq.redis = REDIS
14
- Sidekiq.redis {|c| c.flushdb }
15
14
  end
16
15
 
17
16
  it 'can display home with queue stats tab' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-queue-stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Stephens