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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbd643a40085110519af1f51bbefae8467022412
|
4
|
+
data.tar.gz: 9b0138eb0d1ef8930aaf0be0e08b085a51557032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6d04509c58906775525c538bc6d80e53da9acf0f15125ea23549b392fd46184141440e9636cc96307297fbb48ced3227e8b1877dd1939874b2efdcdce17bfd9
|
7
|
+
data.tar.gz: 28f942925b89a941b53f14dbd62841fa68e689ac1cb80d82e3a95f5da948699a1ac6598ddd1eee800e61cd34a9ddb37ba5cc58d0f7cf7400a4c387efaf156b88
|
data/lib/sidekiq/queue_stats.rb
CHANGED
@@ -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
|
-
<% @
|
13
|
-
<li><a href=<%="?
|
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[:
|
23
|
-
<h4><%= @
|
24
|
-
<% if @
|
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
|
-
<% @
|
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 @
|
43
|
+
<% if @queues_list.empty? %>
|
44
44
|
<div class="alert alert-success">Nothing waiting in any queue</div>
|
45
45
|
<% else %>
|
46
|
-
<% @
|
46
|
+
<% @queues_list.each do |q| %>
|
47
47
|
<h4><%= q.capitalize %></h4>
|
48
|
-
<% if @
|
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
|
-
<% @
|
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
|
-
@
|
10
|
-
@
|
9
|
+
@queues_list = Sidekiq::Queue.all.map(&:name)
|
10
|
+
@workers_count = {}
|
11
11
|
|
12
|
-
if params[:
|
13
|
-
@
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@
|
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
|
20
|
-
|
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
|
-
@
|
23
|
+
@workers_count[q.name][job.klass] += 1
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
data/test/web_extension_test.rb
CHANGED