atomic-sidekiq 1.1.2 → 1.1.3

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
- SHA1:
3
- metadata.gz: af06b1517443b34e0a8e08127c1d730c81658c73
4
- data.tar.gz: 01ad8568be11fa6c4e9c67da7422efe903d2b189
2
+ SHA256:
3
+ metadata.gz: f7105489c8bcd6f544b6483f1a70f9d2e597efe83ac0ba8698a7e38de9e574c5
4
+ data.tar.gz: 41e6812af85bca568187cc011cc43fe535245ae7371cbaf077c9393606463f08
5
5
  SHA512:
6
- metadata.gz: 4e9aa27c6fd049d84c0a8010ae8a0a636e3bbfe15ee39a5ad194ef5f7193dcca5779ea5bfe80e257ff67f87f0717da967cf8bf0e802bcb1a4ea2e7a8f45dd561
7
- data.tar.gz: 340e2d9f8997c905d0e6c0df0c11baff6aa7d1218e447fd3770daacc61d513fabad4662a03b2bd36ec437c96b476fd098d5ed644a1338af64296a8142873d39c
6
+ metadata.gz: ee3ffc740ef11258bd1024be322c977fc223d7ba5958808ca10dc5307583170da5dac3e356da6423033579b97c12c272e1d1c699eeaa526e9f810b9818c11b4c
7
+ data.tar.gz: 8e65b95d1a9b04bb237c4bba8269bcf7d5ec3a2aa4d01dfee10ec7aec6095f1a71c4f97e1ed81f9fa29b0661e0dca1e21aa7b10b890087273f8a543d804f90b4
data/.rubocop.yml CHANGED
@@ -19,6 +19,9 @@ Style/DoubleNegation:
19
19
  Style/Documentation:
20
20
  Enabled: false
21
21
 
22
+ Metrics/AbcSize:
23
+ Max: 20
24
+
22
25
  Metrics/BlockLength:
23
26
  Exclude:
24
27
  - spec/**/*.rb
@@ -2,8 +2,8 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "atomic-sidekiq"
5
- s.version = "1.1.2"
6
- s.date = "2018-04-02"
5
+ s.version = "1.1.3"
6
+ s.date = "2018-12-17"
7
7
  s.summary = "Reliable fetcher for Sidekiq"
8
8
  s.description = "Reliable fetcher for Sidekiq"
9
9
  s.homepage = "https://github.com/Colex/atomic-sidekiq"
@@ -1,4 +1,5 @@
1
1
  require "sidekiq"
2
+ require "sidekiq/web"
2
3
  require_relative "atomic_sidekiq/sidekiq/sidekiq"
3
4
  require_relative "atomic_sidekiq/in_flight_queue"
4
5
  require_relative "atomic_sidekiq/in_flight_keymaker"
@@ -3,33 +3,38 @@ module AtomicSidekiq
3
3
  VIEW_PATH = File.expand_path("../../web/views", __dir__)
4
4
 
5
5
  def self.registered(app)
6
+ register_inflight(app)
7
+ register_recovered(app)
8
+ end
9
+
10
+ def self.register_inflight(app)
6
11
  app.get "/in-flight" do
7
- Web.render_in_flight
8
- end
12
+ @jobs = AtomicSidekiq::InFlightQueue.new.list
13
+ @total_size = @jobs.count
14
+ @count = (params[:count] || 25).to_i
15
+ @current_page = (params[:page] || 1).to_i
9
16
 
10
- app.get "/recovered" do
11
- Web.render_recovered
17
+ start_idx = (@current_page - 1) * @count
18
+ end_idx = (@current_page * @count) - 1
19
+ @jobs = @jobs[start_idx..end_idx]
20
+
21
+ erb File.read(File.join(VIEW_PATH, "in_flight.erb"))
12
22
  end
13
23
  end
14
24
 
15
- def self.render_in_flight
16
- @jobs = AtomicSidekiq::InFlightQueue.new.list
17
- @total_size = @jobs.count
18
- @count = 25
19
- @current_page = (params[:page] || 1).to_i
20
- @jobs = @jobs[@current_page..(@current_page + @count)]
21
- erb File.read(File.join(VIEW_PATH, "in_flight.erb"))
22
- end
25
+ def self.register_recovered(app)
26
+ app.get "/recovered" do
27
+ @queues = AtomicSidekiq::RecoveredStats.new.stats_by_queue
28
+ @jobs = AtomicSidekiq::RecoveredStats.new.stats_by_job
23
29
 
24
- def self.render_recovered
25
- @queues = AtomicSidekiq::RecoveredStats.new.stats_by_queue
26
- @jobs = AtomicSidekiq::RecoveredStats.new.stats_by_job
27
- erb File.read(File.join(VIEW_PATH, "recovered.erb"))
30
+ erb File.read(File.join(VIEW_PATH, "recovered.erb"))
31
+ end
28
32
  end
29
33
  end
30
34
  end
31
35
 
32
- require "sidekiq/web" unless defined?(Sidekiq::Web)
33
- Sidekiq::Web.register(AtomicSidekiq::Web)
34
- Sidekiq::Web.tabs["In-flight"] = "in-flight"
35
- Sidekiq::Web.tabs["Recovered"] = "recovered"
36
+ if defined?(Sidekiq::Web)
37
+ Sidekiq::Web.register(AtomicSidekiq::Web)
38
+ Sidekiq::Web.tabs["In-flight"] = "in-flight"
39
+ Sidekiq::Web.tabs["Recovered"] = "recovered"
40
+ end
@@ -28,7 +28,7 @@
28
28
  <th><%= t("Queue") %></th>
29
29
  <th><%= t("Expires at") %></th>
30
30
  </thead>
31
- <% @jobs.each do |job| %>
31
+ <% @jobs&.each do |job| %>
32
32
  <tr>
33
33
  <td><%= h job["class"] %> </td>
34
34
  <td><%= h job["args"] %> </td>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomic-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Correia Santos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-02 00:00:00.000000000 Z
11
+ date: 2018-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.5.2
194
+ rubygems_version: 2.7.6
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Reliable fetcher for Sidekiq