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.

Files changed (75) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +61 -0
  3. data/.github/issue_template.md +3 -1
  4. data/.gitignore +3 -0
  5. data/.travis.yml +6 -13
  6. data/5.0-Upgrade.md +56 -0
  7. data/COMM-LICENSE +12 -10
  8. data/Changes.md +177 -1
  9. data/Ent-Changes.md +67 -2
  10. data/Gemfile +12 -22
  11. data/LICENSE +1 -1
  12. data/Pro-4.0-Upgrade.md +35 -0
  13. data/Pro-Changes.md +133 -2
  14. data/README.md +8 -6
  15. data/Rakefile +2 -5
  16. data/bin/sidekiqctl +13 -92
  17. data/bin/sidekiqload +5 -10
  18. data/lib/generators/sidekiq/templates/worker_spec.rb.erb +1 -1
  19. data/lib/sidekiq/api.rb +148 -58
  20. data/lib/sidekiq/cli.rb +120 -81
  21. data/lib/sidekiq/client.rb +25 -18
  22. data/lib/sidekiq/core_ext.rb +1 -119
  23. data/lib/sidekiq/ctl.rb +221 -0
  24. data/lib/sidekiq/delay.rb +42 -0
  25. data/lib/sidekiq/exception_handler.rb +2 -4
  26. data/lib/sidekiq/extensions/generic_proxy.rb +7 -1
  27. data/lib/sidekiq/fetch.rb +1 -1
  28. data/lib/sidekiq/job_logger.rb +25 -0
  29. data/lib/sidekiq/job_retry.rb +262 -0
  30. data/lib/sidekiq/launcher.rb +20 -20
  31. data/lib/sidekiq/logging.rb +18 -2
  32. data/lib/sidekiq/manager.rb +5 -6
  33. data/lib/sidekiq/middleware/server/active_record.rb +10 -0
  34. data/lib/sidekiq/processor.rb +126 -48
  35. data/lib/sidekiq/rails.rb +8 -73
  36. data/lib/sidekiq/redis_connection.rb +43 -5
  37. data/lib/sidekiq/scheduled.rb +35 -8
  38. data/lib/sidekiq/testing.rb +16 -7
  39. data/lib/sidekiq/util.rb +5 -2
  40. data/lib/sidekiq/version.rb +1 -1
  41. data/lib/sidekiq/web/action.rb +3 -7
  42. data/lib/sidekiq/web/application.rb +37 -17
  43. data/lib/sidekiq/web/helpers.rb +69 -22
  44. data/lib/sidekiq/web/router.rb +10 -10
  45. data/lib/sidekiq/web.rb +4 -4
  46. data/lib/sidekiq/worker.rb +118 -19
  47. data/lib/sidekiq.rb +27 -27
  48. data/sidekiq.gemspec +6 -17
  49. data/web/assets/javascripts/application.js +0 -0
  50. data/web/assets/javascripts/dashboard.js +32 -17
  51. data/web/assets/stylesheets/application-rtl.css +246 -0
  52. data/web/assets/stylesheets/application.css +371 -6
  53. data/web/assets/stylesheets/bootstrap-rtl.min.css +9 -0
  54. data/web/assets/stylesheets/bootstrap.css +2 -2
  55. data/web/locales/ar.yml +81 -0
  56. data/web/locales/en.yml +2 -0
  57. data/web/locales/es.yml +4 -3
  58. data/web/locales/fa.yml +1 -0
  59. data/web/locales/he.yml +79 -0
  60. data/web/locales/ja.yml +5 -3
  61. data/web/locales/ur.yml +80 -0
  62. data/web/views/_footer.erb +5 -2
  63. data/web/views/_nav.erb +4 -18
  64. data/web/views/_paging.erb +1 -1
  65. data/web/views/busy.erb +9 -5
  66. data/web/views/dashboard.erb +1 -1
  67. data/web/views/layout.erb +11 -2
  68. data/web/views/morgue.erb +4 -4
  69. data/web/views/queue.erb +8 -7
  70. data/web/views/queues.erb +2 -0
  71. data/web/views/retries.erb +9 -5
  72. data/web/views/scheduled.erb +2 -2
  73. metadata +30 -159
  74. data/lib/sidekiq/middleware/server/logging.rb +0 -31
  75. data/lib/sidekiq/middleware/server/retry_jobs.rb +0 -205
data/lib/sidekiq.rb CHANGED
@@ -1,12 +1,13 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
2
+
3
3
  require 'sidekiq/version'
4
- fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.0.0." if RUBY_PLATFORM != 'java' && RUBY_VERSION < '2.0.0'
4
+ fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.2.2." if RUBY_PLATFORM != 'java' && Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2')
5
5
 
6
6
  require 'sidekiq/logging'
7
7
  require 'sidekiq/client'
8
8
  require 'sidekiq/worker'
9
9
  require 'sidekiq/redis_connection'
10
+ require 'sidekiq/delay'
10
11
 
11
12
  require 'json'
12
13
 
@@ -17,13 +18,14 @@ module Sidekiq
17
18
  DEFAULTS = {
18
19
  queues: [],
19
20
  labels: [],
20
- concurrency: 25,
21
+ concurrency: 10,
21
22
  require: '.',
22
23
  environment: nil,
23
24
  timeout: 8,
24
25
  poll_interval_average: nil,
25
- average_scheduled_poll_interval: 15,
26
+ average_scheduled_poll_interval: 5,
26
27
  error_handlers: [],
28
+ death_handlers: [],
27
29
  lifecycle_events: {
28
30
  startup: [],
29
31
  quiet: [],
@@ -33,7 +35,6 @@ module Sidekiq
33
35
  dead_max_jobs: 10_000,
34
36
  dead_timeout_in_seconds: 180 * 24 * 60 * 60, # 6 months
35
37
  reloader: proc { |&block| block.call },
36
- executor: proc { |&block| block.call },
37
38
  }
38
39
 
39
40
  DEFAULT_WORKER_OPTIONS = {
@@ -47,7 +48,7 @@ module Sidekiq
47
48
  "connected_clients" => "9999",
48
49
  "used_memory_human" => "9P",
49
50
  "used_memory_peak_human" => "9P"
50
- }.freeze
51
+ }
51
52
 
52
53
  def self.❨╯°□°❩╯︵┻━┻
53
54
  puts "Calm down, yo."
@@ -56,6 +57,7 @@ module Sidekiq
56
57
  def self.options
57
58
  @options ||= DEFAULTS.dup
58
59
  end
60
+
59
61
  def self.options=(opts)
60
62
  @options = opts
61
63
  end
@@ -94,8 +96,8 @@ module Sidekiq
94
96
  begin
95
97
  yield conn
96
98
  rescue Redis::CommandError => ex
97
- #2550 Failover can cause the server to become a slave, need
98
- # to disconnect and reopen the socket to get back to the master.
99
+ #2550 Failover can cause the server to become a replica, need
100
+ # to disconnect and reopen the socket to get back to the primary.
99
101
  (conn.disconnect!; retryable = false; retry) if retryable && ex.message =~ /READONLY/
100
102
  raise
101
103
  end
@@ -145,32 +147,34 @@ module Sidekiq
145
147
  end
146
148
 
147
149
  def self.default_server_middleware
148
- require 'sidekiq/middleware/server/retry_jobs'
149
- require 'sidekiq/middleware/server/logging'
150
-
151
- Middleware::Chain.new do |m|
152
- m.add Middleware::Server::RetryJobs
153
- m.add Middleware::Server::Logging
154
- end
150
+ Middleware::Chain.new
155
151
  end
156
152
 
157
153
  def self.default_worker_options=(hash)
158
- @default_worker_options = default_worker_options.merge(hash.stringify_keys)
154
+ # stringify
155
+ @default_worker_options = default_worker_options.merge(Hash[hash.map{|k, v| [k.to_s, v]}])
159
156
  end
160
157
  def self.default_worker_options
161
158
  defined?(@default_worker_options) ? @default_worker_options : DEFAULT_WORKER_OPTIONS
162
159
  end
163
160
 
161
+ def self.default_retries_exhausted=(prok)
162
+ logger.info { "default_retries_exhausted is deprecated, please use `config.death_handlers << -> {|job, ex| }`" }
163
+ return nil unless prok
164
+ death_handlers << prok
165
+ end
166
+
167
+ ##
168
+ # Death handlers are called when all retries for a job have been exhausted and
169
+ # the job dies. It's the notification to your application
170
+ # that this job will not succeed without manual intervention.
171
+ #
164
172
  # Sidekiq.configure_server do |config|
165
- # config.default_retries_exhausted = -> (job, ex) do
173
+ # config.death_handlers << ->(job, ex) do
166
174
  # end
167
175
  # end
168
- def self.default_retries_exhausted=(prok)
169
- @default_retries_exhausted = prok
170
- end
171
- @default_retries_exhausted = ->(job, ex) { }
172
- def self.default_retries_exhausted
173
- @default_retries_exhausted
176
+ def self.death_handlers
177
+ options[:death_handlers]
174
178
  end
175
179
 
176
180
  def self.load_json(string)
@@ -228,10 +232,6 @@ module Sidekiq
228
232
  # otherwise Ruby's Thread#kill will commit. See #377.
229
233
  # DO NOT RESCUE THIS ERROR IN YOUR WORKERS
230
234
  class Shutdown < Interrupt; end
231
-
232
235
  end
233
236
 
234
- require 'sidekiq/extensions/class_methods'
235
- require 'sidekiq/extensions/action_mailer'
236
- require 'sidekiq/extensions/active_record'
237
237
  require 'sidekiq/rails' if defined?(::Rails::Engine)
data/sidekiq.gemspec CHANGED
@@ -1,5 +1,4 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/sidekiq/version', __FILE__)
1
+ require_relative 'lib/sidekiq/version'
3
2
 
4
3
  Gem::Specification.new do |gem|
5
4
  gem.authors = ["Mike Perham"]
@@ -11,22 +10,12 @@ Gem::Specification.new do |gem|
11
10
 
12
11
  gem.executables = ['sidekiq', 'sidekiqctl']
13
12
  gem.files = `git ls-files | grep -Ev '^(test|myapp|examples)'`.split("\n")
14
- gem.test_files = []
15
13
  gem.name = "sidekiq"
16
- gem.require_paths = ["lib"]
17
14
  gem.version = Sidekiq::VERSION
18
- gem.add_dependency 'redis', '~> 3.2', '>= 3.2.1'
19
- gem.add_dependency 'connection_pool', '~> 2.2', '>= 2.2.0'
20
- gem.add_dependency 'concurrent-ruby', '~> 1.0'
21
- gem.add_dependency 'rack-protection', '>= 1.5.0'
22
- gem.add_development_dependency 'redis-namespace', '~> 1.5', '>= 1.5.2'
23
- gem.add_development_dependency 'minitest', '~> 5.10', '>= 5.10.1'
24
- gem.add_development_dependency 'rake', '~> 10.0'
25
- gem.add_development_dependency 'rails', '>= 3.2.0'
15
+ gem.required_ruby_version = ">= 2.2.2"
26
16
 
27
- gem.add_development_dependency 'capybara', '~> 2.11'
28
- gem.add_development_dependency 'poltergeist', '~> 1.12'
29
- gem.add_development_dependency 'percy-capybara', '~> 2.3'
30
- gem.add_development_dependency 'timecop', '~> 0.8'
31
- gem.add_development_dependency 'mocha', '~> 1.1'
17
+ gem.add_dependency "redis", "~> 4.5", "< 4.6.0"
18
+ gem.add_dependency 'connection_pool', '~> 2.2', '>= 2.2.2'
19
+ gem.add_dependency 'rack', '~> 2.0'
20
+ gem.add_dependency 'rack-protection', '>= 1.5.0'
32
21
  end
File without changes