sidekiq 2.5.1 → 2.5.2
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.
- data/.rvmrc +0 -1
- data/Changes.md +10 -0
- data/Gemfile +2 -5
- data/examples/sinkiq.rb +2 -2
- data/lib/sidekiq/cli.rb +7 -2
- data/lib/sidekiq/manager.rb +4 -4
- data/lib/sidekiq/middleware/server/retry_jobs.rb +1 -1
- data/lib/sidekiq/testing.rb +3 -2
- data/lib/sidekiq/version.rb +1 -1
- data/lib/sidekiq/web.rb +2 -59
- data/sidekiq.gemspec +0 -4
- data/test/helper.rb +4 -1
- data/test/test_middleware.rb +0 -1
- data/test/test_retry.rb +1 -1
- data/test/test_stats.rb +6 -8
- data/test/test_testing.rb +31 -0
- data/web/assets/javascripts/application.js +6 -11
- data/web/assets/javascripts/vendor/bootstrap.js +6 -2026
- data/web/assets/javascripts/vendor/jquery.js +2 -9265
- data/web/assets/stylesheets/application.css +544 -4
- data/web/assets/stylesheets/bootstrap.css +20 -0
- data/web/views/_workers.slim +1 -1
- data/web/views/layout.slim +6 -3
- metadata +3 -81
- data/web/assets/stylesheets/layout.css +0 -30
- data/web/assets/stylesheets/partials/_base.scss +0 -116
- data/web/assets/stylesheets/partials/_colors.scss +0 -46
- data/web/assets/stylesheets/partials/_fonts.scss +0 -3
- data/web/assets/stylesheets/partials/_h5bp.scss +0 -293
- data/web/assets/stylesheets/partials/_layout.scss +0 -197
- data/web/assets/stylesheets/partials/_navbar.scss +0 -100
- data/web/assets/stylesheets/partials/_normalize.scss +0 -504
- data/web/assets/stylesheets/partials/_prettify.css +0 -30
- data/web/assets/stylesheets/partials/_variables.scss +0 -28
- data/web/assets/stylesheets/public.scss +0 -74
- data/web/assets/stylesheets/style.scss +0 -69
- data/web/assets/stylesheets/vendor/bootstrap-responsive.css +0 -1040
- data/web/assets/stylesheets/vendor/bootstrap.css +0 -5624
- data/web/assets/stylesheets/vendors.scss +0 -2
data/.rvmrc
CHANGED
data/Changes.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
2.5.2
|
2
|
+
-----------
|
3
|
+
|
4
|
+
- Remove asset pipeline from Web UI for much faster, simpler runtime. [#499, #490, #481]
|
5
|
+
- Add -g option so the procline better identifies a Sidekiq process, defaults to File.basename(Rails.root). [#486]
|
6
|
+
|
7
|
+
sidekiq 2.5.1 myapp [0 of 25 busy]
|
8
|
+
|
9
|
+
- Add splay to retry time so groups of failed jobs don't fire all at once. [#483]
|
10
|
+
|
1
11
|
2.5.1
|
2
12
|
-----------
|
3
13
|
|
data/Gemfile
CHANGED
@@ -3,16 +3,13 @@ gemspec
|
|
3
3
|
|
4
4
|
gem 'celluloid', "~> 0.12.0"
|
5
5
|
gem 'slim'
|
6
|
-
gem '
|
7
|
-
gem 'rails', '3.2.8'
|
8
|
-
gem 'sqlite3'
|
6
|
+
gem 'sqlite3', :platform => :mri
|
9
7
|
|
10
8
|
group :test do
|
11
9
|
gem 'simplecov', :require => false
|
12
10
|
end
|
13
11
|
|
14
12
|
group :development do
|
15
|
-
gem '
|
16
|
-
gem 'compass'
|
13
|
+
gem 'pry', :platform => :mri
|
17
14
|
gem 'shotgun'
|
18
15
|
end
|
data/examples/sinkiq.rb
CHANGED
@@ -19,8 +19,8 @@ class SinatraWorker
|
|
19
19
|
end
|
20
20
|
|
21
21
|
get '/' do
|
22
|
-
@failed = Sidekiq
|
23
|
-
@processed = Sidekiq
|
22
|
+
@failed = Sidekiq.info[:failed]
|
23
|
+
@processed = Sidekiq.info[:processed]
|
24
24
|
@messages = $redis.lrange('sinkiq-example-messages', 0, -1)
|
25
25
|
erb :index
|
26
26
|
end
|
data/lib/sidekiq/cli.rb
CHANGED
@@ -126,6 +126,7 @@ module Sidekiq
|
|
126
126
|
require 'sidekiq/rails'
|
127
127
|
require File.expand_path("#{options[:require]}/config/environment.rb")
|
128
128
|
::Rails.application.eager_load!
|
129
|
+
options[:tag] ||= File.basename(::Rails.root)
|
129
130
|
else
|
130
131
|
require options[:require]
|
131
132
|
end
|
@@ -164,7 +165,11 @@ module Sidekiq
|
|
164
165
|
end
|
165
166
|
|
166
167
|
o.on '-t', '--timeout NUM', "Shutdown timeout" do |arg|
|
167
|
-
opts[:timeout] = arg
|
168
|
+
opts[:timeout] = Integer(arg)
|
169
|
+
end
|
170
|
+
|
171
|
+
o.on '-g', '--tag TAG', "Process tag for procline" do |arg|
|
172
|
+
opts[:tag] = arg
|
168
173
|
end
|
169
174
|
|
170
175
|
o.on '-r', '--require [PATH|DIR]', "Location of Rails application with workers or file to require" do |arg|
|
@@ -172,7 +177,7 @@ module Sidekiq
|
|
172
177
|
end
|
173
178
|
|
174
179
|
o.on '-c', '--concurrency INT', "processor threads to use" do |arg|
|
175
|
-
opts[:concurrency] = arg
|
180
|
+
opts[:concurrency] = Integer(arg)
|
176
181
|
end
|
177
182
|
|
178
183
|
o.on '-P', '--pidfile PATH', "path to pidfile" do |arg|
|
data/lib/sidekiq/manager.rb
CHANGED
@@ -27,7 +27,7 @@ module Sidekiq
|
|
27
27
|
@busy = []
|
28
28
|
@fetcher = Fetcher.new(current_actor, options[:queues], !!options[:strict])
|
29
29
|
@ready = @count.times.map { Processor.new_link(current_actor) }
|
30
|
-
procline
|
30
|
+
procline(options[:tag] ? "#{options[:tag]} " : '')
|
31
31
|
end
|
32
32
|
|
33
33
|
def stop(options={})
|
@@ -153,9 +153,9 @@ module Sidekiq
|
|
153
153
|
@done
|
154
154
|
end
|
155
155
|
|
156
|
-
def procline
|
157
|
-
$0 = "sidekiq #{Sidekiq::VERSION} [#{@busy.size} of #{@count} busy]#{stopped? ? ' stopping' : ''}"
|
158
|
-
after(5) { procline }
|
156
|
+
def procline(tag)
|
157
|
+
$0 = "sidekiq #{Sidekiq::VERSION} #{tag}[#{@busy.size} of #{@count} busy]#{stopped? ? ' stopping' : ''}"
|
158
|
+
after(5) { procline(tag) }
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
data/lib/sidekiq/testing.rb
CHANGED
data/lib/sidekiq/version.rb
CHANGED
data/lib/sidekiq/web.rb
CHANGED
@@ -1,75 +1,17 @@
|
|
1
1
|
require 'sinatra/base'
|
2
2
|
require 'slim'
|
3
|
-
require 'sprockets'
|
4
|
-
require 'sprockets-sass'
|
5
|
-
require 'sass'
|
6
|
-
require 'compass'
|
7
3
|
require 'sidekiq/paginator'
|
8
4
|
|
9
5
|
module Sidekiq
|
10
|
-
class SprocketsMiddleware
|
11
|
-
def initialize(app, options={})
|
12
|
-
@app = app
|
13
|
-
@root = options[:root]
|
14
|
-
path = options[:path] || 'assets'
|
15
|
-
@matcher = /^\/#{path}\/*/
|
16
|
-
@environment = ::Sprockets::Environment.new(@root)
|
17
|
-
@environment.append_path 'assets/javascripts'
|
18
|
-
@environment.append_path 'assets/javascripts/vendor'
|
19
|
-
@environment.append_path 'assets/stylesheets'
|
20
|
-
@environment.append_path 'assets/stylesheets/vendor'
|
21
|
-
@environment.append_path 'assets/images'
|
22
|
-
|
23
|
-
Compass.configuration do |config|
|
24
|
-
|
25
|
-
config.project_path = "#{@root}/assets"
|
26
|
-
|
27
|
-
config.images_dir = 'images'
|
28
|
-
config.sass_dir = 'stylesheets'
|
29
|
-
config.css_dir = 'stylesheets'
|
30
|
-
config.javascripts_dir = 'javascripts'
|
31
|
-
config.fonts_dir = 'stylesheets/fonts'
|
32
|
-
|
33
|
-
config.http_images_path = '/assets'
|
34
|
-
config.http_generated_images_path = '/assets'
|
35
|
-
config.http_javascripts_path = '/assets'
|
36
|
-
config.http_stylesheets_path = '/assets'
|
37
|
-
|
38
|
-
# You can select your preferred output style here (can be overridden via the command line):
|
39
|
-
output_style = :compressed
|
40
|
-
|
41
|
-
# To enable relative paths to assets via compass helper functions. Uncomment:
|
42
|
-
relative_assets = true
|
43
|
-
|
44
|
-
# To disable debugging comments that display the original location of your selectors. Uncomment:
|
45
|
-
line_comments = false
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def call(env)
|
52
|
-
# Solve the problem of people requesting /sidekiq when they need to request /sidekiq/ so
|
53
|
-
# that relative links in templates resolve correctly.
|
54
|
-
return [301, { 'Location' => "#{env['SCRIPT_NAME']}/", 'Content-Type' => 'text/html' }, ['redirecting']] if env['SCRIPT_NAME'] == env['REQUEST_PATH']
|
55
|
-
|
56
|
-
return @app.call(env) unless @matcher =~ env["PATH_INFO"]
|
57
|
-
env['PATH_INFO'].sub!(@matcher,'')
|
58
|
-
@environment.call(env)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
6
|
class Web < Sinatra::Base
|
63
7
|
include Sidekiq::Paginator
|
64
8
|
|
65
9
|
dir = File.expand_path(File.dirname(__FILE__) + "/../../web")
|
10
|
+
set :public_folder, "#{dir}/assets"
|
66
11
|
set :views, "#{dir}/views"
|
67
12
|
set :root, "#{dir}/public"
|
68
13
|
set :slim, :pretty => true
|
69
14
|
|
70
|
-
use SprocketsMiddleware, :root => dir
|
71
|
-
|
72
|
-
|
73
15
|
helpers do
|
74
16
|
|
75
17
|
def reset_worker_list
|
@@ -295,3 +237,4 @@ module Sidekiq
|
|
295
237
|
end
|
296
238
|
|
297
239
|
end
|
240
|
+
|
data/sidekiq.gemspec
CHANGED
@@ -19,14 +19,10 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_dependency 'connection_pool', '~> 0.9.2'
|
20
20
|
gem.add_dependency 'celluloid', '~> 0.12.0'
|
21
21
|
gem.add_dependency 'multi_json', '~> 1'
|
22
|
-
gem.add_dependency 'sprockets-sass'
|
23
|
-
gem.add_dependency 'sass'
|
24
|
-
gem.add_dependency 'compass'
|
25
22
|
gem.add_development_dependency 'minitest', '~> 3'
|
26
23
|
gem.add_development_dependency 'sinatra'
|
27
24
|
gem.add_development_dependency 'slim'
|
28
25
|
gem.add_development_dependency 'rake'
|
29
26
|
gem.add_development_dependency 'actionmailer', '~> 3'
|
30
27
|
gem.add_development_dependency 'activerecord', '~> 3'
|
31
|
-
gem.add_development_dependency 'pry'
|
32
28
|
end
|
data/test/helper.rb
CHANGED
data/test/test_middleware.rb
CHANGED
data/test/test_retry.rb
CHANGED
data/test/test_stats.rb
CHANGED
@@ -55,7 +55,6 @@ class TestStats < MiniTest::Unit::TestCase
|
|
55
55
|
|
56
56
|
processor = Sidekiq::Processor.new(boss)
|
57
57
|
|
58
|
-
pstr = processor.to_s
|
59
58
|
assert_raises RuntimeError do
|
60
59
|
processor.process(msg, 'xyzzy')
|
61
60
|
end
|
@@ -71,24 +70,23 @@ class TestStats < MiniTest::Unit::TestCase
|
|
71
70
|
conn.rpush 'queue:foo', '{}'
|
72
71
|
conn.sadd 'queues', 'foo'
|
73
72
|
|
74
|
-
conn.rpush 'queue:bar', '{}'
|
75
|
-
conn.rpush 'queue:bar', '{}'
|
73
|
+
3.times { conn.rpush 'queue:bar', '{}' }
|
76
74
|
conn.sadd 'queues', 'bar'
|
77
75
|
|
78
|
-
conn.rpush 'queue:baz', '{}'
|
76
|
+
2.times { conn.rpush 'queue:baz', '{}' }
|
79
77
|
conn.sadd 'queues', 'baz'
|
80
78
|
end
|
81
79
|
end
|
82
80
|
|
83
81
|
describe "queues_with_sizes" do
|
84
82
|
it "returns queue names and corresponding job counts" do
|
85
|
-
assert_equal [["foo", 1], ["baz",
|
83
|
+
assert_equal [["foo", 1], ["baz", 2], ["bar", 3]], Sidekiq.info[:queues_with_sizes]
|
86
84
|
end
|
87
85
|
end
|
88
86
|
|
89
87
|
describe "backlog" do
|
90
88
|
it "returns count of all jobs yet to be processed" do
|
91
|
-
assert_equal
|
89
|
+
assert_equal 6, Sidekiq.info[:backlog]
|
92
90
|
end
|
93
91
|
end
|
94
92
|
|
@@ -97,8 +95,8 @@ class TestStats < MiniTest::Unit::TestCase
|
|
97
95
|
assert_equal 0, Sidekiq.size("foox")
|
98
96
|
assert_equal 1, Sidekiq.size(:foo)
|
99
97
|
assert_equal 1, Sidekiq.size("foo")
|
100
|
-
assert_equal
|
101
|
-
assert_equal
|
98
|
+
assert_equal 4, Sidekiq.size("foo", "bar")
|
99
|
+
assert_equal 6, Sidekiq.size
|
102
100
|
end
|
103
101
|
end
|
104
102
|
end
|
data/test/test_testing.rb
CHANGED
@@ -129,6 +129,15 @@ class TestTesting < MiniTest::Unit::TestCase
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
+
class ThirdWorker
|
133
|
+
include Sidekiq::Worker
|
134
|
+
class_attribute :count
|
135
|
+
def perform
|
136
|
+
FirstWorker.perform_async
|
137
|
+
SecondWorker.perform_async
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
132
141
|
it 'clears jobs across all workers' do
|
133
142
|
Sidekiq::Worker.jobs.clear
|
134
143
|
FirstWorker.count = 0
|
@@ -177,5 +186,27 @@ class TestTesting < MiniTest::Unit::TestCase
|
|
177
186
|
assert_equal 1, FirstWorker.count
|
178
187
|
assert_equal 1, SecondWorker.count
|
179
188
|
end
|
189
|
+
|
190
|
+
it 'drains jobs across all workers even when workers create new jobs' do
|
191
|
+
Sidekiq::Worker.jobs.clear
|
192
|
+
FirstWorker.count = 0
|
193
|
+
SecondWorker.count = 0
|
194
|
+
|
195
|
+
assert_equal 0, ThirdWorker.jobs.size
|
196
|
+
|
197
|
+
assert_equal 0, FirstWorker.count
|
198
|
+
assert_equal 0, SecondWorker.count
|
199
|
+
|
200
|
+
ThirdWorker.perform_async
|
201
|
+
|
202
|
+
assert_equal 1, ThirdWorker.jobs.size
|
203
|
+
|
204
|
+
Sidekiq::Worker.drain_all
|
205
|
+
|
206
|
+
assert_equal 0, ThirdWorker.jobs.size
|
207
|
+
|
208
|
+
assert_equal 1, FirstWorker.count
|
209
|
+
assert_equal 1, SecondWorker.count
|
210
|
+
end
|
180
211
|
end
|
181
212
|
end
|
@@ -1,8 +1,3 @@
|
|
1
|
-
//= require vendor/jquery
|
2
|
-
//= require vendor/jquery.timeago
|
3
|
-
//= require bootstrap
|
4
|
-
//= require_tree .
|
5
|
-
|
6
1
|
$(function() {
|
7
2
|
$.timeago.settings.allowFuture = true;
|
8
3
|
$.timeago.settings.refreshMillis = 0;
|
@@ -25,12 +20,12 @@ $(function() {
|
|
25
20
|
|
26
21
|
$('a[name=poll]').data('polling', false);
|
27
22
|
|
28
|
-
pollStatus = $('.poll-status')
|
23
|
+
var pollStatus = $('.poll-status');
|
29
24
|
|
30
|
-
pollStatusText = pollStatus.find('.text')
|
31
|
-
pollStatusBadge = pollStatus.find('.badge')
|
25
|
+
var pollStatusText = pollStatus.find('.text');
|
26
|
+
var pollStatusBadge = pollStatus.find('.badge');
|
32
27
|
pollStatusBadge.hide();
|
33
|
-
pollStatusMarkup = pollStatus.html();
|
28
|
+
var pollStatusMarkup = pollStatus.html();
|
34
29
|
|
35
30
|
$('a[name=poll]').on('click', function(e) {
|
36
31
|
e.preventDefault();
|
@@ -75,9 +70,9 @@ $(function() {
|
|
75
70
|
$('time').timeago();
|
76
71
|
});
|
77
72
|
var currentTime = new Date();
|
78
|
-
$('.poll-status .text').text('Last polled: ')
|
73
|
+
$('.poll-status .text').text('Last polled: ');
|
79
74
|
$('.poll-status .time').show().text(currentTime.getHours() + ':' + pad(currentTime.getMinutes()) + ':' + pad(currentTime.getSeconds()));
|
80
|
-
}
|
75
|
+
};
|
81
76
|
});
|
82
77
|
|
83
78
|
$(function() {
|