sidekiq-queue-stats 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 040c2775a432c3db474725620b8a36a26f20bf08
4
- data.tar.gz: 6da0a35136e728df9e03a46383a74051eeded396
3
+ metadata.gz: 026c2ff9f949d48ada4885f8e7dae2b4679389bd
4
+ data.tar.gz: 4fcdbfad5a850932a63b55c850780ed07e1b64f8
5
5
  SHA512:
6
- metadata.gz: 7c5744bf185ba0b4d52d986e659a8660071f2bcc7f90dae011ee7c096887dc3d97fa8568ac27793dc0868bb1a615307cb53f10ec1ce482da48367be5e9819440
7
- data.tar.gz: 78b398d6a334aa2dc4793fbdad702c806f4a59574c421dd833cf139fbac74af615d076dc72a801f2c3cc43b76f009925e65622dd6a71e0e6d2773da680804d72
6
+ metadata.gz: 220467b4fda45cf4809e1126795ae03990ac82e11b0362ff9896aa044b75deaaf4de95f181a0e944aa9a2d31d3058c7eb2ecf3804046123034f9da0250852f9c
7
+ data.tar.gz: 3e8e08b53beb70950bbdab3640b14b3b1e46e4e8acdba1be8136f6646aa8642e85aa4f75283adb1efae6027f93112757820e3d59674d39fc58436bf227169ac6
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Keeps track of Sidekiq job count and adds a tab to the Web UI to let you view totals.
4
4
 
5
- [WARNING] Large amounts of jobs in queues can cause this gem to slowly load. Use the 'Live Poll' button at your own risk.
6
-
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module QueueStats
3
- VERSION = "1.0.3"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@
10
10
  <span class="caret"></span>
11
11
  </button>
12
12
  <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
13
- <li><a href="?queue=all">All</a></li>
13
+ <li><a href="#">All</a></li>
14
14
  <% @queues.each do |q| %>
15
15
  <li><a href=<%="?queue=#{q.downcase}"%>><%= q.capitalize %></a></li>
16
16
  <% end %>
@@ -18,7 +18,27 @@
18
18
  </div>
19
19
 
20
20
  <%= csrf_tag if respond_to?(:csrf_tag) %>
21
- <% if params[:queue] == "all" %>
21
+ <% if params[:queue] %>
22
+ <h4><%= @queue.name.capitalize %></h4>
23
+ <% if @workers[@queue.name].nil? %>
24
+ <div class="alert alert-success">Nothing waiting in queue</div>
25
+ <% else %>
26
+ <table class="table table-striped table-bordered table-white">
27
+ <thead>
28
+ <tr>
29
+ <th>Name</th>
30
+ <th style="width: 150px">Count</th>
31
+ </tr>
32
+ </thead>
33
+ <% @workers[@queue.name].each do |worker| %>
34
+ <tr>
35
+ <td><%=worker.first%></td>
36
+ <td><%=worker.last%></td>
37
+ </tr>
38
+ <% end %>
39
+ </table>
40
+ <% end %>
41
+ <% else %>
22
42
  <% @queues.each do |q| %>
23
43
  <h4><%= q.capitalize %></h4>
24
44
  <% if @workers[q].empty? %>
@@ -40,24 +60,4 @@
40
60
  </table>
41
61
  <% end %>
42
62
  <% end %>
43
- <% else %>
44
- <h4><%= @queue.name.capitalize %></h4>
45
- <% if @workers[@queue.name].nil? %>
46
- <div class="alert alert-success">Nothing waiting in queue</div>
47
- <% else %>
48
- <table class="table table-striped table-bordered table-white">
49
- <thead>
50
- <tr>
51
- <th>Name</th>
52
- <th style="width: 150px">Count</th>
53
- </tr>
54
- </thead>
55
- <% @workers[@queue.name].each do |worker| %>
56
- <tr>
57
- <td><%=worker.first%></td>
58
- <td><%=worker.last%></td>
59
- </tr>
60
- <% end %>
61
- </table>
62
- <% end %>
63
63
  <% end %>
@@ -9,24 +9,17 @@ module QueueStats
9
9
  @queues = Sidekiq::Queue.all.map(&:name)
10
10
  @workers = {}
11
11
 
12
- if params[:queue] == "all"
13
- Sidekiq::Queue.all.each do |q|
14
- @workers[q.name] = {}
15
- total = q.map{|cue| cue.klass}
16
- klasses = total.uniq
17
- klasses.each do |klass|
18
- @workers[q.name][klass] = total.count(klass)
19
- end
12
+ if params[:queue]
13
+ @queue = params[:queue] ? Sidekiq::Queue.new(params[:queue]) : Sidekiq::Queue.new
14
+ @workers[@queue.name] = Hash.new(0)
15
+ @queue.each do |job|
16
+ @workers[@queue.name][job.klass] += 1
20
17
  end
21
18
  else
22
- @queue = params[:queue] ? Sidekiq::Queue.new(params[:queue]) : Sidekiq::Queue.new
23
- @workers[@queue.name] = {}
24
-
25
- total = @queue.map{|cue| cue.klass}
26
- klasses = total.uniq
27
- if klasses
28
- klasses.each do |klass|
29
- @workers[@queue.name][klass] = total.count(klass)
19
+ Sidekiq::Queue.all.each do |q|
20
+ @workers[q.name] = Hash.new(0)
21
+ q.each do |job|
22
+ @workers[q.name][job.klass] += 1
30
23
  end
31
24
  end
32
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-queue-stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Stephens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-26 00:00:00.000000000 Z
11
+ date: 2016-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq