sidekiq-status 2.0.0 → 2.1.2
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 +4 -4
- data/.travis.yml +1 -0
- data/Appraisals +4 -0
- data/CHANGELOG.md +19 -4
- data/README.md +2 -2
- data/gemfiles/sidekiq_6.1.gemfile +7 -0
- data/lib/sidekiq-status/client_middleware.rb +4 -2
- data/lib/sidekiq-status/version.rb +1 -1
- data/sidekiq-status.gemspec +1 -1
- data/spec/lib/sidekiq-status/client_middleware_spec.rb +3 -3
- data/spec/lib/sidekiq-status/server_middleware_spec.rb +4 -4
- data/spec/lib/sidekiq-status/web_spec.rb +1 -1
- data/spec/lib/sidekiq-status_spec.rb +1 -1
- data/spec/support/test_jobs.rb +3 -3
- data/web/views/status.erb +10 -9
- data/web/views/status_not_found.erb +3 -2
- data/web/views/statuses.erb +12 -11
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c02846f130e9fc47945e6e85e03d2e5cb5033e1d5a55f8b9ade921b72839f3a4
|
4
|
+
data.tar.gz: e236b4fd1fd3b94387b31786fe0aff021904b1947cf3bc2b26e66fceb6e38ca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 274efd30dff5904a2c1b39c2940e6785f8a446aada35e2a6fe38e58ddbc22ce0866e84e487e2bebfa439ca7ed06f862ff30c15fd3df5c48a3b59f03a6eabb95b
|
7
|
+
data.tar.gz: 590bd3e108417ba70cfa7706885a524f014f80ead06aef364b113099620fb362cafa181c0640ef2adb9309891ed33b3bac41585944e9a091716bc4ae4cf553ef
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,23 @@
|
|
1
|
+
**Version 2.1.2**
|
2
|
+
* Casts values to strings when HTML-encoding
|
3
|
+
|
4
|
+
**Version 2.1.1**
|
5
|
+
* Ensures parameter outputs are properly HTML-encoded
|
6
|
+
|
7
|
+
**Version 2.1.0**
|
8
|
+
* Adds support for Sidekiq 6.2.2+ (https://github.com/mperham/sidekiq/issues/4955)
|
9
|
+
|
10
|
+
**Version 2.0.2**
|
11
|
+
* Fixes for dark mode theme
|
12
|
+
|
13
|
+
**Version 2.0.1**
|
14
|
+
* Adds support for dark mode to the job status page
|
15
|
+
|
1
16
|
**Version 2.0.0**
|
2
|
-
* Adds support for Ruby 2.7, 3.0
|
3
|
-
* Adds support for Sidekiq 6.x
|
4
|
-
* Removes support for Ruby 2.3, 2.4, 2.5
|
5
|
-
* Removes support for Sidekiq 3.x, 4.x
|
17
|
+
* Adds support for Ruby 2.7, 3.0
|
18
|
+
* Adds support for Sidekiq 6.x
|
19
|
+
* Removes support for Ruby 2.3, 2.4, 2.5
|
20
|
+
* Removes support for Sidekiq 3.x, 4.x
|
6
21
|
|
7
22
|
**Versions 1.1.4 and prior**
|
8
23
|
|
data/README.md
CHANGED
@@ -21,9 +21,9 @@ Or install it yourself as:
|
|
21
21
|
gem install sidekiq-status
|
22
22
|
```
|
23
23
|
|
24
|
-
|
24
|
+
#### Migrating to Version 2.x from 1.x
|
25
25
|
|
26
|
-
Version 2.0.0 was published in order to add support for Ruby 3.0 and Sidekiq 6.x and to remove support for versions of both that are now end-of-life. You should be able to upgrade cleanly from version 1.x to 2.x provided you are running Sidekiq 5.x or newer
|
26
|
+
Version 2.0.0 was published in order to add support for Ruby 3.0 and Sidekiq 6.x and to remove support for versions of both that are now end-of-life. **You should be able to upgrade cleanly from version 1.x to 2.x provided you are running Sidekiq 5.x or newer.**
|
27
27
|
|
28
28
|
Sidekiq-status version 1.1.4 provides support all the way back to Sidekiq 3.x and was maintained at https://github.com/utgarda/sidekiq-status/.
|
29
29
|
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'sidekiq/api'
|
2
|
+
JOB_CLASS = Sidekiq.constants.include?(:JobRecord) ? Sidekiq::JobRecord : Sidekiq::Job
|
3
|
+
|
2
4
|
module Sidekiq::Status
|
3
5
|
# Should be in the client middleware chain
|
4
6
|
class ClientMiddleware
|
@@ -34,7 +36,7 @@ module Sidekiq::Status
|
|
34
36
|
initial_metadata = {
|
35
37
|
jid: msg['jid'],
|
36
38
|
status: :queued,
|
37
|
-
worker:
|
39
|
+
worker: JOB_CLASS.new(msg, queue).display_class,
|
38
40
|
args: display_args(msg, queue)
|
39
41
|
}
|
40
42
|
store_for_id msg['jid'], initial_metadata, job_class.new.expiration || @expiration, redis_pool
|
@@ -45,7 +47,7 @@ module Sidekiq::Status
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def display_args(msg, queue)
|
48
|
-
job =
|
50
|
+
job = JOB_CLASS.new(msg, queue)
|
49
51
|
return job.display_args.to_a.empty? ? nil : job.display_args.to_json
|
50
52
|
rescue Exception => e
|
51
53
|
# For Sidekiq ~> 2.7
|
data/sidekiq-status.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.authors = ['Evgeniy Tsvigun', 'Kenaniah Cerny']
|
6
6
|
gem.email = ['utgarda@gmail.com', 'kenaniah@gmail.com']
|
7
7
|
gem.summary = 'An extension to the sidekiq message processing to track your jobs'
|
8
|
-
gem.homepage = '
|
8
|
+
gem.homepage = 'https://github.com/kenaniah/sidekiq-status'
|
9
9
|
gem.license = 'MIT'
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
@@ -12,13 +12,13 @@ describe Sidekiq::Status::ClientMiddleware do
|
|
12
12
|
describe "without :expiration parameter" do
|
13
13
|
|
14
14
|
it "sets queued status" do
|
15
|
-
expect(StubJob.perform_async arg1
|
15
|
+
expect(StubJob.perform_async 'arg1' => 'val1').to eq(job_id)
|
16
16
|
expect(redis.hget("sidekiq:status:#{job_id}", :status)).to eq('queued')
|
17
17
|
expect(Sidekiq::Status::queued?(job_id)).to be_truthy
|
18
18
|
end
|
19
19
|
|
20
20
|
it "sets status hash ttl" do
|
21
|
-
expect(StubJob.perform_async arg1
|
21
|
+
expect(StubJob.perform_async 'arg1' => 'val1').to eq(job_id)
|
22
22
|
expect(1..Sidekiq::Status::DEFAULT_EXPIRY).to cover redis.ttl("sidekiq:status:#{job_id}")
|
23
23
|
end
|
24
24
|
|
@@ -50,7 +50,7 @@ describe Sidekiq::Status::ClientMiddleware do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "overwrites default expiry value" do
|
53
|
-
StubJob.perform_async arg1
|
53
|
+
StubJob.perform_async 'arg1' => 'val1'
|
54
54
|
expect((Sidekiq::Status::DEFAULT_EXPIRY+1)..huge_expiration).to cover redis.ttl("sidekiq:status:#{job_id}")
|
55
55
|
end
|
56
56
|
|
@@ -10,7 +10,7 @@ describe Sidekiq::Status::ServerMiddleware do
|
|
10
10
|
allow(SecureRandom).to receive(:hex).once.and_return(job_id)
|
11
11
|
start_server do
|
12
12
|
thread = redis_thread 4, "status_updates", "job_messages_#{job_id}"
|
13
|
-
expect(ConfirmationJob.perform_async arg1
|
13
|
+
expect(ConfirmationJob.perform_async 'arg1' => 'val1').to eq(job_id)
|
14
14
|
expect(thread.value).to eq([
|
15
15
|
job_id,
|
16
16
|
job_id,
|
@@ -90,7 +90,7 @@ describe Sidekiq::Status::ServerMiddleware do
|
|
90
90
|
it "sets status hash ttl" do
|
91
91
|
allow(SecureRandom).to receive(:hex).once.and_return(job_id)
|
92
92
|
start_server do
|
93
|
-
expect(StubJob.perform_async arg1
|
93
|
+
expect(StubJob.perform_async 'arg1' => 'val1').to eq(job_id)
|
94
94
|
end
|
95
95
|
expect(1..Sidekiq::Status::DEFAULT_EXPIRY).to cover redis.ttl("sidekiq:status:#{job_id}")
|
96
96
|
end
|
@@ -104,7 +104,7 @@ describe Sidekiq::Status::ServerMiddleware do
|
|
104
104
|
|
105
105
|
it "overwrites default expiry value" do
|
106
106
|
start_server(:expiration => huge_expiration) do
|
107
|
-
StubJob.perform_async arg1
|
107
|
+
StubJob.perform_async 'arg1' => 'val1'
|
108
108
|
end
|
109
109
|
expect((Sidekiq::Status::DEFAULT_EXPIRY-1)..huge_expiration).to cover redis.ttl("sidekiq:status:#{job_id}")
|
110
110
|
end
|
@@ -113,7 +113,7 @@ describe Sidekiq::Status::ServerMiddleware do
|
|
113
113
|
overwritten_expiration = huge_expiration * 100
|
114
114
|
allow_any_instance_of(StubJob).to receive(:expiration).and_return(overwritten_expiration)
|
115
115
|
start_server(:expiration => huge_expiration) do
|
116
|
-
StubJob.perform_async arg1
|
116
|
+
StubJob.perform_async 'arg1' => 'val1'
|
117
117
|
end
|
118
118
|
expect((huge_expiration+1)..overwritten_expiration).to cover redis.ttl("sidekiq:status:#{job_id}")
|
119
119
|
end
|
@@ -61,7 +61,7 @@ describe 'sidekiq status web' do
|
|
61
61
|
get "/statuses/#{job_id}"
|
62
62
|
expect(last_response).to be_ok
|
63
63
|
expect(last_response.body).to match(/#{job_id}/)
|
64
|
-
expect(last_response.body).to match(/1
|
64
|
+
expect(last_response.body).to match(/1,"another argument"/)
|
65
65
|
expect(last_response.body).to match(/working/)
|
66
66
|
end
|
67
67
|
|
@@ -159,7 +159,7 @@ describe Sidekiq::Status do
|
|
159
159
|
end
|
160
160
|
|
161
161
|
it "retries failed jobs" do
|
162
|
-
allow(SecureRandom).to receive(:hex).and_return(retried_job_id)
|
162
|
+
allow(SecureRandom).to receive(:hex).exactly(3).times.and_return(retried_job_id)
|
163
163
|
start_server do
|
164
164
|
expect(capture_status_updates(3) {
|
165
165
|
expect(RetriedJob.perform_async()).to eq(retried_job_id)
|
data/spec/support/test_jobs.rb
CHANGED
@@ -119,13 +119,13 @@ end
|
|
119
119
|
|
120
120
|
class RetriedJob < StubJob
|
121
121
|
|
122
|
-
sidekiq_options
|
122
|
+
sidekiq_options retry: true
|
123
123
|
sidekiq_retry_in do |count| 3 end # 3 second delay > job timeout in test suite
|
124
124
|
|
125
|
-
def perform
|
125
|
+
def perform
|
126
126
|
Sidekiq.redis do |conn|
|
127
127
|
key = "RetriedJob_#{jid}"
|
128
|
-
|
128
|
+
if [0, false].include? conn.exists(key)
|
129
129
|
conn.set key, 'tried'
|
130
130
|
raise StandardError
|
131
131
|
end
|
data/web/views/status.erb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
<% require 'cgi'; def h(v); CGI.escape_html(v.to_s); end %>
|
1
2
|
<style>
|
2
3
|
.progress {
|
3
4
|
background-color: #C8E1ED;
|
@@ -14,9 +15,9 @@
|
|
14
15
|
</style>
|
15
16
|
|
16
17
|
<h3>
|
17
|
-
Job Status: <%= @status["jid"] %>
|
18
|
-
<span class='label label-<%= @status["label"] %>'>
|
19
|
-
<%= @status["status"] %>
|
18
|
+
Job Status: <%= h @status["jid"] %>
|
19
|
+
<span class='label label-<%= h @status["label"] %>'>
|
20
|
+
<%= h @status["status"] %>
|
20
21
|
</span>
|
21
22
|
</h3>
|
22
23
|
|
@@ -28,16 +29,16 @@
|
|
28
29
|
</div>
|
29
30
|
</div>
|
30
31
|
|
31
|
-
<div class="panel panel-default">
|
32
|
+
<div class="panel panel-default" style="background-color: inherit">
|
32
33
|
<div class="panel-body">
|
33
|
-
<h4><%= @status["worker"] %></h4>
|
34
|
+
<h4><%= h @status["worker"] %></h4>
|
34
35
|
|
35
36
|
<div class="row">
|
36
37
|
<div class="col-sm-2">
|
37
38
|
<strong>Arguments</strong>
|
38
39
|
</div>
|
39
40
|
<div class="col-sm-10">
|
40
|
-
<p><%= @status["args"].empty? ? "<i>none</i>" : @status["args"] %></p>
|
41
|
+
<p><%= @status["args"].empty? ? "<i>none</i>" : h(@status["args"]) %></p>
|
41
42
|
</div>
|
42
43
|
</div>
|
43
44
|
|
@@ -46,7 +47,7 @@
|
|
46
47
|
<strong>Message</strong>
|
47
48
|
</div>
|
48
49
|
<div class="col-sm-10">
|
49
|
-
<p><%= @status["message"] || "<i>none</i>" %></p>
|
50
|
+
<p><%= h(@status["message"]) || "<i>none</i>" %></p>
|
50
51
|
</div>
|
51
52
|
</div>
|
52
53
|
|
@@ -75,9 +76,9 @@
|
|
75
76
|
</div>
|
76
77
|
<div class="col-sm-10">
|
77
78
|
<% if val && val.include?("\n") %>
|
78
|
-
<pre><%= val %></pre>
|
79
|
+
<pre><%= h val %></pre>
|
79
80
|
<% else %>
|
80
|
-
<p><%= val || "<i>none</i>" %></p>
|
81
|
+
<p><%= h(val) || "<i>none</i>" %></p>
|
81
82
|
<% end %>
|
82
83
|
</div>
|
83
84
|
</div>
|
@@ -1,5 +1,6 @@
|
|
1
|
-
|
1
|
+
<% require 'cgi'; def h(v); CGI.escape_html(v.to_s); end %>
|
2
|
+
<h3>Job Status: <%= h params[:jid] %></h3>
|
2
3
|
|
3
|
-
<div
|
4
|
+
<div role="alert">
|
4
5
|
<strong>Uh oh!</strong> That job can't be found. It may have expired already.
|
5
6
|
</div>
|
data/web/views/statuses.erb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
<% require 'cgi'; def h(v); CGI.escape_html(v.to_s); end %>
|
1
2
|
<style>
|
2
3
|
.progress {
|
3
4
|
background-color: #C8E1ED;
|
@@ -76,11 +77,11 @@ function setPerPage(select){
|
|
76
77
|
</div>
|
77
78
|
</div>
|
78
79
|
</div>
|
79
|
-
<table class="table table-hover table-bordered table-striped
|
80
|
+
<table class="table table-hover table-bordered table-striped">
|
80
81
|
<tr>
|
81
|
-
<% @headers.each do |
|
82
|
-
<th class="header <%= h[:class] %> header_<%= h[:id] %>">
|
83
|
-
<a href="<%= h[:url] %>"><%= h[:name] %></a>
|
82
|
+
<% @headers.each do |hdr| %>
|
83
|
+
<th class="header <%= h hdr[:class] %> header_<%= h hdr[:id] %>">
|
84
|
+
<a href="<%= h hdr[:url] %>"><%= h hdr[:name] %></a>
|
84
85
|
</th>
|
85
86
|
<% end %>
|
86
87
|
<th class="header">
|
@@ -90,13 +91,13 @@ function setPerPage(select){
|
|
90
91
|
<% @statuses.each do |container| %>
|
91
92
|
<tr>
|
92
93
|
<td>
|
93
|
-
<div title='<%= container["jid"] %>'><a href="<%= root_path %>statuses/<%= container["jid"] %>"><%= container["worker"] %></a></div>
|
94
|
+
<div title='<%= h container["jid"] %>'><a href="<%= root_path %>statuses/<%= h container["jid"] %>"><%= h container["worker"] %></a></div>
|
94
95
|
</td>
|
95
96
|
<td>
|
96
|
-
<div class='args' title='<%= container["jid"] %>'><%= container["args"] %></div>
|
97
|
+
<div class='args' title='<%= h container["jid"] %>'><%= h container["args"] %></div>
|
97
98
|
</td>
|
98
99
|
<td style='text-align: center;'>
|
99
|
-
<div class='label label-<%= container["label"] %>'><%= container["status"] %></div>
|
100
|
+
<div class='label label-<%= h container["label"] %>'><%= h container["status"] %></div>
|
100
101
|
</td>
|
101
102
|
<% secs = Time.now.to_i - container["update_time"].to_i %>
|
102
103
|
<td style='text-align: center; white-space: nowrap;' title="<%= Time.at(container["update_time"].to_i) %>">
|
@@ -109,11 +110,11 @@ function setPerPage(select){
|
|
109
110
|
<td>
|
110
111
|
<div class="progress progress-striped" style="margin-bottom: 0">
|
111
112
|
<div class='message' style='text-align:right; padding-right:0.5em; background-color: transparent; float:right;'>
|
112
|
-
<%= container["message"] %>
|
113
|
+
<%= h container["message"] %>
|
113
114
|
</div>
|
114
115
|
<% if container["pct_complete"].to_i > 0 %>
|
115
|
-
<div class="bar message" style="width: <%= container["pct_complete"] %>%;">
|
116
|
-
<%= container["pct_complete"] %>%
|
116
|
+
<div class="bar message" style="width: <%= h container["pct_complete"] %>%;">
|
117
|
+
<%= h container["pct_complete"] %>%
|
117
118
|
</div>
|
118
119
|
<% end %>
|
119
120
|
</div>
|
@@ -121,7 +122,7 @@ function setPerPage(select){
|
|
121
122
|
<td>
|
122
123
|
<div class="actions">
|
123
124
|
<form action="statuses" method="post">
|
124
|
-
<input type="hidden" name="jid" value="<%= container["jid"] %>" />
|
125
|
+
<input type="hidden" name="jid" value="<%= h container["jid"] %>" />
|
125
126
|
<%= csrf_tag %>
|
126
127
|
<% if container["status"] == "complete" %>
|
127
128
|
<input type="hidden" name="_method" value="delete" />
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeniy Tsvigun
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sidekiq
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- README.md
|
143
143
|
- Rakefile
|
144
144
|
- gemfiles/sidekiq_5.x.gemfile
|
145
|
+
- gemfiles/sidekiq_6.1.gemfile
|
145
146
|
- gemfiles/sidekiq_6.x.gemfile
|
146
147
|
- lib/sidekiq-status.rb
|
147
148
|
- lib/sidekiq-status/client_middleware.rb
|
@@ -167,7 +168,7 @@ files:
|
|
167
168
|
- web/views/status.erb
|
168
169
|
- web/views/status_not_found.erb
|
169
170
|
- web/views/statuses.erb
|
170
|
-
homepage:
|
171
|
+
homepage: https://github.com/kenaniah/sidekiq-status
|
171
172
|
licenses:
|
172
173
|
- MIT
|
173
174
|
metadata: {}
|
@@ -186,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
187
|
- !ruby/object:Gem::Version
|
187
188
|
version: '0'
|
188
189
|
requirements: []
|
189
|
-
rubygems_version: 3.2.
|
190
|
+
rubygems_version: 3.2.32
|
190
191
|
signing_key:
|
191
192
|
specification_version: 4
|
192
193
|
summary: An extension to the sidekiq message processing to track your jobs
|