sidekiq-status 2.1.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/CHANGELOG.md +9 -0
- data/lib/sidekiq-status/version.rb +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/support/test_jobs.rb +3 -3
- data/web/views/status.erb +9 -8
- data/web/views/status_not_found.erb +2 -1
- data/web/views/statuses.erb +11 -10
- metadata +3 -3
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/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
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
|
+
|
1
10
|
**Version 2.0.2**
|
2
11
|
* Fixes for dark mode theme
|
3
12
|
|
@@ -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
|
|
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
|
|
@@ -30,14 +31,14 @@
|
|
30
31
|
|
31
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>
|
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;
|
@@ -78,9 +79,9 @@ function setPerPage(select){
|
|
78
79
|
</div>
|
79
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.1.
|
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
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
- !ruby/object:Gem::Version
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
|
-
rubygems_version: 3.2.
|
190
|
+
rubygems_version: 3.2.32
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: An extension to the sidekiq message processing to track your jobs
|