sidekiq-worker-stats 0.1.0 → 1.0.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: c122618cce95df1122b43e01959cf1c1c57e3aba
4
- data.tar.gz: 0731d9a5c1cf8fbb28de6a5c695b82a3610fe2ca
3
+ metadata.gz: a2acf9694cc59e265871dfe3dbbf2999190b240d
4
+ data.tar.gz: 7643b8d0cda97c9a5c9230606e986cd6301f124e
5
5
  SHA512:
6
- metadata.gz: 82d6dc4890f8ec2e5f40657ebae8db9fe314e4718581de73535529fffa8d2dbb912ceb26117ec36cf2fa4e0bb73f65059481c885b406b677a2ac3020fc96a131
7
- data.tar.gz: d98fd137be342db47e7bee89bd3f6d605e49839c18c37f8aa9a69d5a107b773c6688d3bca5b5f8b2a57aa5d9784c5d5888aa161c91189d6ac08e060d1cb6b84d
6
+ metadata.gz: 9fd4ffc5243f146a74f819ea77634b62214de66c1549a15e1f761b12da218ce6a67c28ee302f5dd7251d747739d53bd7c9e6812ec302e84e5aa2813259db141e
7
+ data.tar.gz: 03836d89418b16d51e3805331ca57e6a33c87e32ca5aadc46a5c81cdd41b1bed32dfda5aa00e4159da98c3502879adf4a39e6c3de22baf425ed080da658bf5ca
@@ -5,7 +5,4 @@ rvm:
5
5
  - 2.3.1
6
6
  env:
7
7
  matrix:
8
- - SIDEKIQ_VERSION="~> 2.16"
9
- - SIDEKIQ_VERSION="~> 2.17"
10
- - SIDEKIQ_VERSION="~> 3.0"
11
- - SIDEKIQ_VERSION="~> 3.1"
8
+ - SIDEKIQ_VERSION="~> 4.2.2"
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
 
6
6
  gem 'sidekiq', ENV['SIDEKIQ_VERSION'] if ENV['SIDEKIQ_VERSION']
7
7
  gem 'minitest'
8
+ gem 'pry'
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module WorkerStats
3
- VERSION = "0.1.0"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -18,37 +18,17 @@
18
18
  </div>
19
19
 
20
20
  <%= csrf_tag if respond_to?(:csrf_tag) %>
21
- <h4><%= @queue.name.capitalize %></h4>
22
- <% if @workers[@queue.name].nil? %>
23
- <div class="alert alert-success">Nothing waiting in queue</div>
24
- <% else %>
25
- <table class="table table-striped table-bordered table-white">
26
- <thead>
27
- <tr>
28
- <th>Name</th>
29
- <th>Count</th>
30
- </tr>
31
- </thead>
32
- <% @workers[@queue.name].each do |worker| %>
33
- <tr>
34
- <td><%=worker.first%></td>
35
- <td><%=worker.last%></td>
36
- </tr>
37
- <% end %>
38
- </table>
39
- <% end %>
40
-
41
21
  <% if params[:queue] == "all" %>
42
22
  <% @queues.each do |q| %>
43
23
  <h4><%= q.capitalize %></h4>
44
- <% if @workers[q].nil? %>
24
+ <% if @workers[q].empty? %>
45
25
  <div class="alert alert-success">Nothing waiting in queue</div>
46
26
  <% else %>
47
27
  <table class="table table-striped table-bordered table-white">
48
28
  <thead>
49
29
  <tr>
50
30
  <th>Name</th>
51
- <th>Count</th>
31
+ <th style="width: 150px">Count</th>
52
32
  </tr>
53
33
  </thead>
54
34
  <% @workers[q].each do |worker| %>
@@ -60,4 +40,24 @@
60
40
  </table>
61
41
  <% end %>
62
42
  <% end %>
43
+ <% else %>
44
+ <h4><%= @queue.name.capitalize %></h4>
45
+ <% if @workers[@queue].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 %>
@@ -7,7 +7,6 @@ module Sidekiq
7
7
 
8
8
  app.get "/worker_stats" do
9
9
  @queues = Sidekiq::Queue.all.map(&:name)
10
- @queue = params[:queue] ? Sidekiq::Queue.new(params[:queue]) : Sidekiq::Queue.new
11
10
  @workers = {}
12
11
 
13
12
  if params[:queue] == "all"
@@ -20,12 +19,13 @@ module Sidekiq
20
19
  end
21
20
  end
22
21
  else
23
- @queue.each do |q|
24
- @workers[q.name] = {}
25
- total = q.map{|cue| cue.klass}
26
- klasses = total.uniq
22
+ @queue = params[:queue] ? Sidekiq::Queue.new(params[:queue]) : Sidekiq::Queue.new
23
+ @workers[@queue.name] = {}
24
+ total = @queue.map{|cue| cue.klass}
25
+ klasses = total.uniq
26
+ if klasses
27
27
  klasses.each do |klass|
28
- @workers[q.name][klass] = total.count(klass)
28
+ @workers[@queue.name][klass] = total.count(klass)
29
29
  end
30
30
  end
31
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-worker-stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Stephens