sidekiq 4.2.9 → 4.2.10
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/issue_template.md +6 -1
- data/.travis.yml +10 -5
- data/Changes.md +9 -0
- data/Ent-Changes.md +9 -0
- data/Pro-Changes.md +29 -0
- data/bin/sidekiqload +11 -11
- data/lib/sidekiq.rb +1 -1
- data/lib/sidekiq/api.rb +20 -12
- data/lib/sidekiq/middleware/server/logging.rb +8 -17
- data/lib/sidekiq/processor.rb +16 -7
- data/lib/sidekiq/testing.rb +6 -0
- data/lib/sidekiq/version.rb +1 -1
- data/lib/sidekiq/web/application.rb +2 -2
- data/lib/sidekiq/web/helpers.rb +2 -1
- data/sidekiq.gemspec +8 -2
- data/web/assets/javascripts/dashboard.js +1 -1
- data/web/locales/fa.yml +79 -0
- data/web/views/_job_info.erb +1 -1
- data/web/views/dashboard.erb +2 -2
- data/web/views/morgue.erb +2 -0
- data/web/views/queue.erb +2 -2
- data/web/views/queues.erb +2 -2
- data/web/views/retry.erb +1 -1
- metadata +74 -63
- data/test/config.yml +0 -9
- data/test/env_based_config.yml +0 -11
- data/test/fake_env.rb +0 -1
- data/test/fixtures/en.yml +0 -2
- data/test/helper.rb +0 -75
- data/test/test_actors.rb +0 -138
- data/test/test_api.rb +0 -528
- data/test/test_cli.rb +0 -418
- data/test/test_client.rb +0 -266
- data/test/test_exception_handler.rb +0 -56
- data/test/test_extensions.rb +0 -129
- data/test/test_fetch.rb +0 -50
- data/test/test_launcher.rb +0 -92
- data/test/test_logging.rb +0 -35
- data/test/test_manager.rb +0 -50
- data/test/test_middleware.rb +0 -158
- data/test/test_processor.rb +0 -249
- data/test/test_rails.rb +0 -22
- data/test/test_redis_connection.rb +0 -132
- data/test/test_retry.rb +0 -326
- data/test/test_retry_exhausted.rb +0 -149
- data/test/test_scheduled.rb +0 -115
- data/test/test_scheduling.rb +0 -58
- data/test/test_sidekiq.rb +0 -107
- data/test/test_testing.rb +0 -143
- data/test/test_testing_fake.rb +0 -359
- data/test/test_testing_inline.rb +0 -94
- data/test/test_util.rb +0 -13
- data/test/test_web.rb +0 -679
- data/test/test_web_helpers.rb +0 -54
data/web/views/_job_info.erb
CHANGED
data/web/views/dashboard.erb
CHANGED
@@ -9,9 +9,9 @@
|
|
9
9
|
</h3>
|
10
10
|
<div class="interval-slider">
|
11
11
|
<span class="interval-slider-label"><%= t('PollingInterval') %>:</span>
|
12
|
-
<span class="current-interval">
|
12
|
+
<span class="current-interval">5 sec</span>
|
13
13
|
<br/>
|
14
|
-
<input type="range" min="2000" max="20000" step="1000" value="
|
14
|
+
<input type="range" min="2000" max="20000" step="1000" value="5000"/>
|
15
15
|
</div>
|
16
16
|
</div>
|
17
17
|
|
data/web/views/morgue.erb
CHANGED
data/web/views/queue.erb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
</h3>
|
9
9
|
</div>
|
10
10
|
<div class="col-sm-4 pull-right">
|
11
|
-
<%= erb :_paging, locals: { url: "#{root_path}queues/#{@name}" } %>
|
11
|
+
<%= erb :_paging, locals: { url: "#{root_path}queues/#{CGI.escape(@name)}" } %>
|
12
12
|
</div>
|
13
13
|
</header>
|
14
14
|
<div class="table_container">
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<% end %>
|
33
33
|
</td>
|
34
34
|
<td>
|
35
|
-
<form action="<%= root_path %>queues/<%= @name %>/delete" method="post">
|
35
|
+
<form action="<%= root_path %>queues/<%= CGI.escape(@name) %>/delete" method="post">
|
36
36
|
<%= csrf_tag %>
|
37
37
|
<input name="key_val" value="<%= h Sidekiq.dump_json(msg.item) %>" type="hidden" />
|
38
38
|
<input class="btn btn-danger btn-xs" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSure') %>" />
|
data/web/views/queues.erb
CHANGED
@@ -10,14 +10,14 @@
|
|
10
10
|
<% @queues.each do |queue| %>
|
11
11
|
<tr>
|
12
12
|
<td>
|
13
|
-
<a href="<%= root_path %>queues/<%= queue.name %>"><%= queue.name %></a>
|
13
|
+
<a href="<%= root_path %>queues/<%= CGI.escape(queue.name) %>"><%= h queue.name %></a>
|
14
14
|
<% if queue.paused? %>
|
15
15
|
<span class="label label-danger"><%= t('Paused') %></span>
|
16
16
|
<% end %>
|
17
17
|
</td>
|
18
18
|
<td><%= number_with_delimiter(queue.size) %> </td>
|
19
19
|
<td class="delete-confirm">
|
20
|
-
<form action="<%=root_path %>queues/<%= queue.name %>" method="post">
|
20
|
+
<form action="<%=root_path %>queues/<%= CGI.escape(queue.name) %>" method="post">
|
21
21
|
<%= csrf_tag %>
|
22
22
|
<input class="btn btn-danger btn-xs" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteQueue', :queue => h(queue.name)) %>" />
|
23
23
|
</form>
|
data/web/views/retry.erb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Perham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -146,6 +146,76 @@ dependencies:
|
|
146
146
|
- - ">="
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: 3.2.0
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
name: capybara
|
151
|
+
requirement: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - "~>"
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '2.11'
|
156
|
+
type: :development
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - "~>"
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '2.11'
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: poltergeist
|
165
|
+
requirement: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '1.12'
|
170
|
+
type: :development
|
171
|
+
prerelease: false
|
172
|
+
version_requirements: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - "~>"
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '1.12'
|
177
|
+
- !ruby/object:Gem::Dependency
|
178
|
+
name: percy-capybara
|
179
|
+
requirement: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - "~>"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '2.3'
|
184
|
+
type: :development
|
185
|
+
prerelease: false
|
186
|
+
version_requirements: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - "~>"
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '2.3'
|
191
|
+
- !ruby/object:Gem::Dependency
|
192
|
+
name: timecop
|
193
|
+
requirement: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - "~>"
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0.8'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - "~>"
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '0.8'
|
205
|
+
- !ruby/object:Gem::Dependency
|
206
|
+
name: mocha
|
207
|
+
requirement: !ruby/object:Gem::Requirement
|
208
|
+
requirements:
|
209
|
+
- - "~>"
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: '1.1'
|
212
|
+
type: :development
|
213
|
+
prerelease: false
|
214
|
+
version_requirements: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - "~>"
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '1.1'
|
149
219
|
description: Simple, efficient background processing for Ruby.
|
150
220
|
email:
|
151
221
|
- mperham@gmail.com
|
@@ -214,36 +284,6 @@ files:
|
|
214
284
|
- lib/sidekiq/web/router.rb
|
215
285
|
- lib/sidekiq/worker.rb
|
216
286
|
- sidekiq.gemspec
|
217
|
-
- test/config.yml
|
218
|
-
- test/env_based_config.yml
|
219
|
-
- test/fake_env.rb
|
220
|
-
- test/fixtures/en.yml
|
221
|
-
- test/helper.rb
|
222
|
-
- test/test_actors.rb
|
223
|
-
- test/test_api.rb
|
224
|
-
- test/test_cli.rb
|
225
|
-
- test/test_client.rb
|
226
|
-
- test/test_exception_handler.rb
|
227
|
-
- test/test_extensions.rb
|
228
|
-
- test/test_fetch.rb
|
229
|
-
- test/test_launcher.rb
|
230
|
-
- test/test_logging.rb
|
231
|
-
- test/test_manager.rb
|
232
|
-
- test/test_middleware.rb
|
233
|
-
- test/test_processor.rb
|
234
|
-
- test/test_rails.rb
|
235
|
-
- test/test_redis_connection.rb
|
236
|
-
- test/test_retry.rb
|
237
|
-
- test/test_retry_exhausted.rb
|
238
|
-
- test/test_scheduled.rb
|
239
|
-
- test/test_scheduling.rb
|
240
|
-
- test/test_sidekiq.rb
|
241
|
-
- test/test_testing.rb
|
242
|
-
- test/test_testing_fake.rb
|
243
|
-
- test/test_testing_inline.rb
|
244
|
-
- test/test_util.rb
|
245
|
-
- test/test_web.rb
|
246
|
-
- test/test_web_helpers.rb
|
247
287
|
- web/assets/images/favicon.ico
|
248
288
|
- web/assets/images/logo.png
|
249
289
|
- web/assets/images/status.png
|
@@ -257,6 +297,7 @@ files:
|
|
257
297
|
- web/locales/el.yml
|
258
298
|
- web/locales/en.yml
|
259
299
|
- web/locales/es.yml
|
300
|
+
- web/locales/fa.yml
|
260
301
|
- web/locales/fr.yml
|
261
302
|
- web/locales/hi.yml
|
262
303
|
- web/locales/it.yml
|
@@ -315,34 +356,4 @@ rubygems_version: 2.5.2
|
|
315
356
|
signing_key:
|
316
357
|
specification_version: 4
|
317
358
|
summary: Simple, efficient background processing for Ruby
|
318
|
-
test_files:
|
319
|
-
- test/config.yml
|
320
|
-
- test/env_based_config.yml
|
321
|
-
- test/fake_env.rb
|
322
|
-
- test/fixtures/en.yml
|
323
|
-
- test/helper.rb
|
324
|
-
- test/test_actors.rb
|
325
|
-
- test/test_api.rb
|
326
|
-
- test/test_cli.rb
|
327
|
-
- test/test_client.rb
|
328
|
-
- test/test_exception_handler.rb
|
329
|
-
- test/test_extensions.rb
|
330
|
-
- test/test_fetch.rb
|
331
|
-
- test/test_launcher.rb
|
332
|
-
- test/test_logging.rb
|
333
|
-
- test/test_manager.rb
|
334
|
-
- test/test_middleware.rb
|
335
|
-
- test/test_processor.rb
|
336
|
-
- test/test_rails.rb
|
337
|
-
- test/test_redis_connection.rb
|
338
|
-
- test/test_retry.rb
|
339
|
-
- test/test_retry_exhausted.rb
|
340
|
-
- test/test_scheduled.rb
|
341
|
-
- test/test_scheduling.rb
|
342
|
-
- test/test_sidekiq.rb
|
343
|
-
- test/test_testing.rb
|
344
|
-
- test/test_testing_fake.rb
|
345
|
-
- test/test_testing_inline.rb
|
346
|
-
- test/test_util.rb
|
347
|
-
- test/test_web.rb
|
348
|
-
- test/test_web_helpers.rb
|
359
|
+
test_files: []
|
data/test/config.yml
DELETED
data/test/env_based_config.yml
DELETED
data/test/fake_env.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
data/test/fixtures/en.yml
DELETED
data/test/helper.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
$TESTING = true
|
3
|
-
# disable minitest/parallel threads
|
4
|
-
ENV["N"] = "0"
|
5
|
-
|
6
|
-
if ENV["COVERAGE"]
|
7
|
-
require 'simplecov'
|
8
|
-
SimpleCov.start do
|
9
|
-
add_filter "/test/"
|
10
|
-
add_filter "/myapp/"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
ENV['RACK_ENV'] = ENV['RAILS_ENV'] = 'test'
|
14
|
-
|
15
|
-
trap 'USR1' do
|
16
|
-
threads = Thread.list
|
17
|
-
|
18
|
-
puts
|
19
|
-
puts "=" * 80
|
20
|
-
puts "Received USR1 signal; printing all #{threads.count} thread backtraces."
|
21
|
-
|
22
|
-
threads.each do |thr|
|
23
|
-
description = thr == Thread.main ? "Main thread" : thr.inspect
|
24
|
-
puts
|
25
|
-
puts "#{description} backtrace: "
|
26
|
-
puts thr.backtrace.join("\n")
|
27
|
-
end
|
28
|
-
|
29
|
-
puts "=" * 80
|
30
|
-
end
|
31
|
-
|
32
|
-
begin
|
33
|
-
require 'pry-byebug'
|
34
|
-
rescue LoadError
|
35
|
-
end
|
36
|
-
|
37
|
-
require 'minitest/autorun'
|
38
|
-
|
39
|
-
require 'sidekiq'
|
40
|
-
require 'sidekiq/util'
|
41
|
-
Sidekiq.logger.level = Logger::ERROR
|
42
|
-
|
43
|
-
Sidekiq::Test = Minitest::Test
|
44
|
-
|
45
|
-
require 'sidekiq/redis_connection'
|
46
|
-
REDIS_URL = ENV['REDIS_URL'] || 'redis://localhost/15'
|
47
|
-
REDIS = Sidekiq::RedisConnection.create(:url => REDIS_URL, :namespace => 'testy')
|
48
|
-
|
49
|
-
Sidekiq.configure_client do |config|
|
50
|
-
config.redis = { :url => REDIS_URL, :namespace => 'testy' }
|
51
|
-
end
|
52
|
-
|
53
|
-
def capture_logging(lvl=Logger::INFO)
|
54
|
-
old = Sidekiq.logger
|
55
|
-
begin
|
56
|
-
out = StringIO.new
|
57
|
-
logger = Logger.new(out)
|
58
|
-
logger.level = lvl
|
59
|
-
Sidekiq.logger = logger
|
60
|
-
yield
|
61
|
-
out.string
|
62
|
-
ensure
|
63
|
-
Sidekiq.logger = old
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def with_logging(lvl=Logger::DEBUG)
|
68
|
-
old = Sidekiq.logger.level
|
69
|
-
begin
|
70
|
-
Sidekiq.logger.level = lvl
|
71
|
-
yield
|
72
|
-
ensure
|
73
|
-
Sidekiq.logger.level = old
|
74
|
-
end
|
75
|
-
end
|
data/test/test_actors.rb
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'helper'
|
3
|
-
require 'sidekiq/cli'
|
4
|
-
require 'sidekiq/fetch'
|
5
|
-
require 'sidekiq/scheduled'
|
6
|
-
require 'sidekiq/processor'
|
7
|
-
|
8
|
-
class TestActors < Sidekiq::Test
|
9
|
-
class JoeWorker
|
10
|
-
include Sidekiq::Worker
|
11
|
-
def perform(slp)
|
12
|
-
raise "boom" if slp == "boom"
|
13
|
-
sleep(slp) if slp > 0
|
14
|
-
$count += 1
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'threads' do
|
19
|
-
before do
|
20
|
-
Sidekiq.redis {|c| c.flushdb}
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'scheduler' do
|
24
|
-
it 'can start and stop' do
|
25
|
-
f = Sidekiq::Scheduled::Poller.new
|
26
|
-
f.start
|
27
|
-
f.terminate
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'can schedule' do
|
31
|
-
ss = Sidekiq::ScheduledSet.new
|
32
|
-
q = Sidekiq::Queue.new
|
33
|
-
|
34
|
-
JoeWorker.perform_in(0.01, 0)
|
35
|
-
|
36
|
-
assert_equal 0, q.size
|
37
|
-
assert_equal 1, ss.size
|
38
|
-
|
39
|
-
sleep 0.015
|
40
|
-
s = Sidekiq::Scheduled::Poller.new
|
41
|
-
s.enqueue
|
42
|
-
assert_equal 1, q.size
|
43
|
-
assert_equal 0, ss.size
|
44
|
-
s.terminate
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'processor' do
|
49
|
-
before do
|
50
|
-
$count = 0
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'can start and stop' do
|
54
|
-
f = Sidekiq::Processor.new(Mgr.new)
|
55
|
-
f.terminate
|
56
|
-
end
|
57
|
-
|
58
|
-
class Mgr
|
59
|
-
attr_reader :latest_error
|
60
|
-
attr_reader :mutex
|
61
|
-
attr_reader :cond
|
62
|
-
def initialize
|
63
|
-
@mutex = ::Mutex.new
|
64
|
-
@cond = ::ConditionVariable.new
|
65
|
-
end
|
66
|
-
def processor_died(inst, err)
|
67
|
-
@latest_error = err
|
68
|
-
@mutex.synchronize do
|
69
|
-
@cond.signal
|
70
|
-
end
|
71
|
-
end
|
72
|
-
def processor_stopped(inst)
|
73
|
-
@mutex.synchronize do
|
74
|
-
@cond.signal
|
75
|
-
end
|
76
|
-
end
|
77
|
-
def options
|
78
|
-
{ :concurrency => 3, :queues => ['default'] }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'can process' do
|
83
|
-
mgr = Mgr.new
|
84
|
-
|
85
|
-
p = Sidekiq::Processor.new(mgr)
|
86
|
-
JoeWorker.perform_async(0)
|
87
|
-
|
88
|
-
a = $count
|
89
|
-
p.process_one
|
90
|
-
b = $count
|
91
|
-
assert_equal a + 1, b
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'deals with errors' do
|
95
|
-
mgr = Mgr.new
|
96
|
-
|
97
|
-
p = Sidekiq::Processor.new(mgr)
|
98
|
-
JoeWorker.perform_async("boom")
|
99
|
-
q = Sidekiq::Queue.new
|
100
|
-
assert_equal 1, q.size
|
101
|
-
|
102
|
-
a = $count
|
103
|
-
mgr.mutex.synchronize do
|
104
|
-
p.start
|
105
|
-
mgr.cond.wait(mgr.mutex)
|
106
|
-
end
|
107
|
-
b = $count
|
108
|
-
assert_equal a, b
|
109
|
-
|
110
|
-
sleep 0.001
|
111
|
-
assert_equal false, p.thread.status
|
112
|
-
p.terminate(true)
|
113
|
-
refute_nil mgr.latest_error
|
114
|
-
assert_equal RuntimeError, mgr.latest_error.class
|
115
|
-
end
|
116
|
-
|
117
|
-
it 'gracefully kills' do
|
118
|
-
mgr = Mgr.new
|
119
|
-
|
120
|
-
p = Sidekiq::Processor.new(mgr)
|
121
|
-
JoeWorker.perform_async(1)
|
122
|
-
q = Sidekiq::Queue.new
|
123
|
-
assert_equal 1, q.size
|
124
|
-
|
125
|
-
a = $count
|
126
|
-
p.start
|
127
|
-
sleep(0.02)
|
128
|
-
p.terminate
|
129
|
-
p.kill(true)
|
130
|
-
|
131
|
-
b = $count
|
132
|
-
assert_equal a, b
|
133
|
-
assert_equal false, p.thread.status
|
134
|
-
refute mgr.latest_error, mgr.latest_error.to_s
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|