sidekiq 4.2.10 → 5.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 +5 -5
- data/.circleci/config.yml +61 -0
- data/.github/issue_template.md +3 -1
- data/.gitignore +3 -0
- data/.travis.yml +6 -13
- data/5.0-Upgrade.md +56 -0
- data/COMM-LICENSE +12 -10
- data/Changes.md +177 -1
- data/Ent-Changes.md +67 -2
- data/Gemfile +12 -22
- data/LICENSE +1 -1
- data/Pro-4.0-Upgrade.md +35 -0
- data/Pro-Changes.md +133 -2
- data/README.md +8 -6
- data/Rakefile +2 -5
- data/bin/sidekiqctl +13 -92
- data/bin/sidekiqload +5 -10
- data/lib/generators/sidekiq/templates/worker_spec.rb.erb +1 -1
- data/lib/sidekiq/api.rb +148 -58
- data/lib/sidekiq/cli.rb +120 -81
- data/lib/sidekiq/client.rb +25 -18
- data/lib/sidekiq/core_ext.rb +1 -119
- data/lib/sidekiq/ctl.rb +221 -0
- data/lib/sidekiq/delay.rb +42 -0
- data/lib/sidekiq/exception_handler.rb +2 -4
- data/lib/sidekiq/extensions/generic_proxy.rb +7 -1
- data/lib/sidekiq/fetch.rb +1 -1
- data/lib/sidekiq/job_logger.rb +25 -0
- data/lib/sidekiq/job_retry.rb +262 -0
- data/lib/sidekiq/launcher.rb +20 -20
- data/lib/sidekiq/logging.rb +18 -2
- data/lib/sidekiq/manager.rb +5 -6
- data/lib/sidekiq/middleware/server/active_record.rb +10 -0
- data/lib/sidekiq/processor.rb +126 -48
- data/lib/sidekiq/rails.rb +8 -73
- data/lib/sidekiq/redis_connection.rb +43 -5
- data/lib/sidekiq/scheduled.rb +35 -8
- data/lib/sidekiq/testing.rb +16 -7
- data/lib/sidekiq/util.rb +5 -2
- data/lib/sidekiq/version.rb +1 -1
- data/lib/sidekiq/web/action.rb +3 -7
- data/lib/sidekiq/web/application.rb +37 -17
- data/lib/sidekiq/web/helpers.rb +69 -22
- data/lib/sidekiq/web/router.rb +10 -10
- data/lib/sidekiq/web.rb +4 -4
- data/lib/sidekiq/worker.rb +118 -19
- data/lib/sidekiq.rb +27 -27
- data/sidekiq.gemspec +6 -17
- data/web/assets/javascripts/application.js +0 -0
- data/web/assets/javascripts/dashboard.js +32 -17
- data/web/assets/stylesheets/application-rtl.css +246 -0
- data/web/assets/stylesheets/application.css +371 -6
- data/web/assets/stylesheets/bootstrap-rtl.min.css +9 -0
- data/web/assets/stylesheets/bootstrap.css +2 -2
- data/web/locales/ar.yml +81 -0
- data/web/locales/en.yml +2 -0
- data/web/locales/es.yml +4 -3
- data/web/locales/fa.yml +1 -0
- data/web/locales/he.yml +79 -0
- data/web/locales/ja.yml +5 -3
- data/web/locales/ur.yml +80 -0
- data/web/views/_footer.erb +5 -2
- data/web/views/_nav.erb +4 -18
- data/web/views/_paging.erb +1 -1
- data/web/views/busy.erb +9 -5
- data/web/views/dashboard.erb +1 -1
- data/web/views/layout.erb +11 -2
- data/web/views/morgue.erb +4 -4
- data/web/views/queue.erb +8 -7
- data/web/views/queues.erb +2 -0
- data/web/views/retries.erb +9 -5
- data/web/views/scheduled.erb +2 -2
- metadata +30 -159
- data/lib/sidekiq/middleware/server/logging.rb +0 -31
- data/lib/sidekiq/middleware/server/retry_jobs.rb +0 -205
data/Pro-Changes.md
CHANGED
@@ -1,11 +1,142 @@
|
|
1
|
-
Sidekiq Pro Changelog
|
2
|
-
|
1
|
+
# Sidekiq Pro Changelog
|
2
|
+
|
3
|
+
[Sidekiq Changes](https://github.com/mperham/sidekiq/blob/master/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md)
|
3
4
|
|
4
5
|
Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
|
5
6
|
|
6
7
|
HEAD
|
7
8
|
---------
|
8
9
|
|
10
|
+
- Add ES translations, see issues [#3949](https://github.com/mperham/sidekiq/issues/3949) and [#3951](https://github.com/mperham/sidekiq/issues/3951) to add your own language.
|
11
|
+
|
12
|
+
4.0.5
|
13
|
+
---------
|
14
|
+
|
15
|
+
- Increase super\_fetch retriever thread count from 1 to 2 to make it
|
16
|
+
less sensitive to Redis latency.
|
17
|
+
- Better handling of invalid job JSON by reliable scheduler [#4053]
|
18
|
+
- Added ZH, PT, JA and RU translations.
|
19
|
+
|
20
|
+
4.0.4
|
21
|
+
---------
|
22
|
+
|
23
|
+
- Update Sidekiq::Client patches to work with new Module#prepend
|
24
|
+
mechanism in Sidekiq 5.2.0. [#3930]
|
25
|
+
|
26
|
+
4.0.3
|
27
|
+
---------
|
28
|
+
|
29
|
+
- Add at\_exit handler to push any saved jobs in `reliable_push` when exiting. [#3823]
|
30
|
+
- Implement batch death callback. This is fired the first time a job within a batch dies. [#3841]
|
31
|
+
```ruby
|
32
|
+
batch = Sidekiq::Batch.new
|
33
|
+
batch.on(:death, ...)
|
34
|
+
```
|
35
|
+
|
36
|
+
4.0.2
|
37
|
+
---------
|
38
|
+
|
39
|
+
- Remove super\_fetch edge case leading to an unnecessary `sleep(1)`
|
40
|
+
call and resulting latency [#3790]
|
41
|
+
- Fix possible bad statsd metric call on super\_fetch startup
|
42
|
+
- Remove superfluous `freeze` calls on Strings [#3759]
|
43
|
+
|
44
|
+
4.0.1
|
45
|
+
---------
|
46
|
+
|
47
|
+
- Fix incompatibility with the statsd-ruby gem [#3740]
|
48
|
+
- Add tags to Statsd metrics when using Datadog [#3744]
|
49
|
+
|
50
|
+
4.0.0
|
51
|
+
---------
|
52
|
+
|
53
|
+
- See the [Sidekiq Pro 4.0](Pro-4.0-Upgrade.md) release notes.
|
54
|
+
|
55
|
+
|
56
|
+
3.7.1
|
57
|
+
---------
|
58
|
+
|
59
|
+
- Deprecate timed\_fetch. Switch to super\_fetch:
|
60
|
+
```ruby
|
61
|
+
config.super_fetch!
|
62
|
+
```
|
63
|
+
|
64
|
+
|
65
|
+
3.7.0
|
66
|
+
---------
|
67
|
+
|
68
|
+
- Refactor batch job success/failure to gracefully handle several edge
|
69
|
+
cases with regard to Sidekiq::Shutdown. This should greatly reduce
|
70
|
+
the chances of seeing the long-standing "negative pending count" problem. [#3710]
|
71
|
+
|
72
|
+
|
73
|
+
3.6.1
|
74
|
+
---------
|
75
|
+
|
76
|
+
- Add support for Datadog::Statsd, it is the recommended Statsd client. [#3699]
|
77
|
+
```ruby
|
78
|
+
Sidekiq::Pro.dogstatsd = ->{ Datadog::Statsd.new("metrics.example.com", 8125) }
|
79
|
+
```
|
80
|
+
- Size the statsd connection pool based on Sidekiq's concurrency [#3700]
|
81
|
+
|
82
|
+
|
83
|
+
3.6.0
|
84
|
+
---------
|
85
|
+
|
86
|
+
This release overhauls the Statsd metrics support and adds more
|
87
|
+
metrics for tracking Pro feature usage. In your initializer:
|
88
|
+
```ruby
|
89
|
+
Sidekiq::Pro.statsd = ->{ ::Statsd.new("127.0.0.1", 8125) }
|
90
|
+
```
|
91
|
+
Sidekiq Pro will emit more metrics to Statsd:
|
92
|
+
```
|
93
|
+
jobs.expired - when a job is expired
|
94
|
+
jobs.recovered.push - when a job is recovered by reliable_push after network outage
|
95
|
+
jobs.recovered.fetch - when a job is recovered by super_fetch after process crash
|
96
|
+
batch.created - when a batch is created
|
97
|
+
batch.complete - when a batch is completed
|
98
|
+
batch.success - when a batch is successful
|
99
|
+
```
|
100
|
+
Sidekiq Pro's existing Statsd middleware has been rewritten to leverage the new API.
|
101
|
+
Everything should be backwards compatible with one deprecation notice.
|
102
|
+
|
103
|
+
|
104
|
+
3.5.4
|
105
|
+
---------
|
106
|
+
|
107
|
+
- Fix case in SuperFetch where Redis downtime can lead to processor thread death [#3684]
|
108
|
+
- Fix case where TimedFetch might not recover some pending jobs
|
109
|
+
- Fix edge case in Batch::Status#poll leading to premature completion [#3640]
|
110
|
+
- Adjust scan API to check 100 elements at a time, to minimize network round trips
|
111
|
+
when scanning large sets.
|
112
|
+
|
113
|
+
3.5.3
|
114
|
+
---------
|
115
|
+
|
116
|
+
- Restore error check for super\_fetch's job ack [#3601]
|
117
|
+
- Trim error messages saved in Batch's failure hash, preventing huge
|
118
|
+
messages from bloating Redis. [#3570]
|
119
|
+
|
120
|
+
3.5.2
|
121
|
+
---------
|
122
|
+
|
123
|
+
- Fix `Status#completed?` when run against a Batch that had succeeded
|
124
|
+
and was deleted. [#3519]
|
125
|
+
|
126
|
+
3.5.1
|
127
|
+
---------
|
128
|
+
|
129
|
+
- Work with Sidekiq 5.0.2+
|
130
|
+
- Improve performance of super\_fetch with weighted queues [#3489]
|
131
|
+
|
132
|
+
3.5.0
|
133
|
+
---------
|
134
|
+
|
135
|
+
- Add queue pause/unpause endpoints for scripting via curl [#3445]
|
136
|
+
- Change how super\_fetch names private queues to avoid hostname/queue clashes. [#3443]
|
137
|
+
- Re-implement `Sidekiq::Queue#delete_job` to avoid O(n) runtime [#3408]
|
138
|
+
- Batch page displays Pending JIDs if less than 10 [#3130]
|
139
|
+
- Batch page has a Search button to find associated Retries [#3130]
|
9
140
|
- Make Batch UI progress bar more friendly to the colorblind [#3387]
|
10
141
|
|
11
142
|
3.4.5
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@ Sidekiq
|
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/sidekiq.svg)](https://rubygems.org/gems/sidekiq)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/mperham/sidekiq.svg)](https://codeclimate.com/github/mperham/sidekiq)
|
6
|
-
[![Build Status](https://
|
6
|
+
[![Build Status](https://circleci.com/gh/mperham/sidekiq/tree/master.svg?style=svg)](https://circleci.com/gh/mperham/sidekiq/tree/master)
|
7
7
|
[![Gitter Chat](https://badges.gitter.im/mperham/sidekiq.svg)](https://gitter.im/mperham/sidekiq)
|
8
8
|
|
9
9
|
|
@@ -28,13 +28,14 @@ Sidekiq 3.5.1 | 22ms | 1257 MB | 125 sec | 800 jobs/sec
|
|
28
28
|
Resque 1.25.2 | - | - | 420 sec | 240 jobs/sec
|
29
29
|
DelayedJob 4.1.1 | - | - | 465 sec | 215 jobs/sec
|
30
30
|
|
31
|
+
<small>This benchmark can be found in `bin/sidekiqload`.</small>
|
31
32
|
|
32
33
|
Requirements
|
33
34
|
-----------------
|
34
35
|
|
35
|
-
Sidekiq supports CRuby 2.
|
36
|
+
Sidekiq supports CRuby 2.2.2+ and JRuby 9k.
|
36
37
|
|
37
|
-
All Rails releases >=
|
38
|
+
All Rails releases >= 4.0 are officially supported.
|
38
39
|
|
39
40
|
Redis 2.8 or greater is required. 3.0.3+ is recommended for large
|
40
41
|
installations with thousands of worker threads.
|
@@ -76,17 +77,18 @@ Problems?
|
|
76
77
|
If you have a problem, please review the [FAQ](https://github.com/mperham/sidekiq/wiki/FAQ) and [Troubleshooting](https://github.com/mperham/sidekiq/wiki/Problems-and-Troubleshooting) wiki pages.
|
77
78
|
Searching the [issues](https://github.com/mperham/sidekiq/issues) for your problem is also a good idea.
|
78
79
|
|
80
|
+
Sidekiq Pro and Sidekiq Enterprise customers get private email support. You can purchase at http://sidekiq.org; email support@contribsys.com for help.
|
81
|
+
|
79
82
|
Useful resources:
|
80
83
|
|
81
84
|
* Product documentation is in the [wiki](https://github.com/mperham/sidekiq/wiki).
|
82
85
|
* Release announcements are made to the [@sidekiq](https://twitter.com/sidekiq) Twitter account.
|
83
|
-
* Here's a [Reddit forum](https://reddit.com/r/sidekiq) dedicated to Sidekiq discussion
|
84
86
|
* The [Sidekiq tag](https://stackoverflow.com/questions/tagged/sidekiq) on Stack Overflow has lots of useful Q & A.
|
85
87
|
|
86
|
-
**No support via Twitter
|
88
|
+
**No support via Twitter**
|
87
89
|
|
88
90
|
Every Friday morning is Sidekiq happy hour: I video chat and answer questions.
|
89
|
-
See the [Sidekiq support page](http://sidekiq.org/support) for details.
|
91
|
+
See the [Sidekiq support page](http://sidekiq.org/support.html) for details.
|
90
92
|
|
91
93
|
Thanks
|
92
94
|
-----------------
|
data/Rakefile
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rake/testtask'
|
3
|
+
|
3
4
|
Rake::TestTask.new(:test) do |test|
|
4
5
|
test.warning = true
|
5
6
|
test.pattern = 'test/**/test_*.rb'
|
6
7
|
end
|
7
8
|
|
8
|
-
task :
|
9
|
-
|
10
|
-
task :appraise do
|
11
|
-
exec("cd myapp && rake appraise")
|
12
|
-
end
|
9
|
+
task default: :test
|
data/bin/sidekiqctl
CHANGED
@@ -1,99 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'fileutils'
|
4
|
+
require 'sidekiq/api'
|
5
|
+
require 'sidekiq/ctl'
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
attr_reader :stage, :pidfile, :kill_timeout
|
9
|
-
|
10
|
-
def self.print_usage
|
11
|
-
puts "#{File.basename($0)} - stop a Sidekiq process from the command line."
|
12
|
-
puts
|
13
|
-
puts "Usage: #{File.basename($0)} <command> <pidfile> <kill_timeout>"
|
14
|
-
puts " where <command> is either 'quiet' or 'stop'"
|
15
|
-
puts " <pidfile> is path to a pidfile"
|
16
|
-
puts " <kill_timeout> is number of seconds to wait until Sidekiq exits"
|
17
|
-
puts " (default: #{Sidekiqctl::DEFAULT_KILL_TIMEOUT}), after which Sidekiq will be KILL'd"
|
18
|
-
puts
|
19
|
-
puts "Be sure to set the kill_timeout LONGER than Sidekiq's -t timeout. If you want"
|
20
|
-
puts "to wait 60 seconds for jobs to finish, use `sidekiq -t 60` and `sidekiqctl stop"
|
21
|
-
puts " path_to_pidfile 61`"
|
22
|
-
puts
|
23
|
-
end
|
24
|
-
|
25
|
-
def initialize(stage, pidfile, timeout)
|
26
|
-
@stage = stage
|
27
|
-
@pidfile = pidfile
|
28
|
-
@kill_timeout = timeout
|
29
|
-
|
30
|
-
done('No pidfile given', :error) if !pidfile
|
31
|
-
done("Pidfile #{pidfile} does not exist", :warn) if !File.exist?(pidfile)
|
32
|
-
done('Invalid pidfile content', :error) if pid == 0
|
33
|
-
|
34
|
-
fetch_process
|
35
|
-
|
36
|
-
begin
|
37
|
-
send(stage)
|
38
|
-
rescue NoMethodError
|
39
|
-
done "Invalid command: #{stage}", :error
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def fetch_process
|
44
|
-
Process.kill(0, pid)
|
45
|
-
rescue Errno::ESRCH
|
46
|
-
done "Process doesn't exist", :error
|
47
|
-
# We were not allowed to send a signal, but the process must have existed
|
48
|
-
# when Process.kill() was called.
|
49
|
-
rescue Errno::EPERM
|
50
|
-
return pid
|
51
|
-
end
|
52
|
-
|
53
|
-
def done(msg, error = nil)
|
54
|
-
puts msg
|
55
|
-
exit(exit_signal(error))
|
56
|
-
end
|
57
|
-
|
58
|
-
def exit_signal(error)
|
59
|
-
(error == :error) ? 1 : 0
|
60
|
-
end
|
61
|
-
|
62
|
-
def pid
|
63
|
-
@pid ||= File.read(pidfile).to_i
|
64
|
-
end
|
65
|
-
|
66
|
-
def quiet
|
67
|
-
`kill -USR1 #{pid}`
|
68
|
-
end
|
69
|
-
|
70
|
-
def stop
|
71
|
-
`kill -TERM #{pid}`
|
72
|
-
kill_timeout.times do
|
73
|
-
begin
|
74
|
-
Process.kill(0, pid)
|
75
|
-
rescue Errno::ESRCH
|
76
|
-
FileUtils.rm_f pidfile
|
77
|
-
done 'Sidekiq shut down gracefully.'
|
78
|
-
rescue Errno::EPERM
|
79
|
-
done 'Not permitted to shut down Sidekiq.'
|
80
|
-
end
|
81
|
-
sleep 1
|
82
|
-
end
|
83
|
-
`kill -9 #{pid}`
|
84
|
-
FileUtils.rm_f pidfile
|
85
|
-
done 'Sidekiq shut down forcefully.'
|
86
|
-
end
|
87
|
-
alias_method :shutdown, :stop
|
88
|
-
end
|
89
|
-
|
90
|
-
if ARGV.length < 2
|
91
|
-
Sidekiqctl.print_usage
|
7
|
+
if ARGV[0] == 'status'
|
8
|
+
Sidekiq::Ctl::Status.new.display(ARGV[1])
|
92
9
|
else
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
10
|
+
if ARGV.length < 2
|
11
|
+
Sidekiq::Ctl.print_usage
|
12
|
+
else
|
13
|
+
stage = ARGV[0]
|
14
|
+
pidfile = ARGV[1]
|
15
|
+
timeout = ARGV[2].to_i
|
16
|
+
timeout = Sidekiq::Ctl::DEFAULT_KILL_TIMEOUT if timeout == 0
|
97
17
|
|
98
|
-
|
18
|
+
Sidekiq::Ctl.new(stage, pidfile, timeout)
|
19
|
+
end
|
99
20
|
end
|
data/bin/sidekiqload
CHANGED
@@ -46,7 +46,7 @@ end
|
|
46
46
|
#}])
|
47
47
|
|
48
48
|
self_read, self_write = IO.pipe
|
49
|
-
%w(INT TERM
|
49
|
+
%w(INT TERM TSTP TTIN).each do |sig|
|
50
50
|
begin
|
51
51
|
trap sig do
|
52
52
|
self_write.puts(sig)
|
@@ -65,19 +65,14 @@ def handle_signal(launcher, sig)
|
|
65
65
|
# http://jira.codehaus.org/browse/JRUBY-4637
|
66
66
|
raise Interrupt
|
67
67
|
when 'TERM'
|
68
|
-
# Heroku sends TERM and then waits
|
68
|
+
# Heroku sends TERM and then waits 30 seconds for process to exit.
|
69
69
|
raise Interrupt
|
70
|
-
when '
|
71
|
-
Sidekiq.logger.info "Received
|
70
|
+
when 'TSTP'
|
71
|
+
Sidekiq.logger.info "Received TSTP, no longer accepting new work"
|
72
72
|
launcher.quiet
|
73
|
-
when 'USR2'
|
74
|
-
if Sidekiq.options[:logfile]
|
75
|
-
Sidekiq.logger.info "Received USR2, reopening log file"
|
76
|
-
Sidekiq::Logging.reopen_logs
|
77
|
-
end
|
78
73
|
when 'TTIN'
|
79
74
|
Thread.list.each do |thread|
|
80
|
-
Sidekiq.logger.warn "Thread TID-#{thread.object_id.to_s(36)} #{thread['label']}"
|
75
|
+
Sidekiq.logger.warn "Thread TID-#{(thread.object_id ^ ::Process.pid).to_s(36)} #{thread['label']}"
|
81
76
|
if thread.backtrace
|
82
77
|
Sidekiq.logger.warn thread.backtrace.join("\n")
|
83
78
|
else
|