sidekiq 5.2.9 → 6.2.1
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/Changes.md +232 -0
- data/README.md +18 -34
- data/bin/sidekiq +26 -2
- data/bin/sidekiqload +32 -24
- data/bin/sidekiqmon +8 -0
- data/lib/generators/sidekiq/templates/worker_test.rb.erb +1 -1
- data/lib/generators/sidekiq/worker_generator.rb +21 -13
- data/lib/sidekiq/api.rb +257 -219
- data/lib/sidekiq/cli.rb +144 -180
- data/lib/sidekiq/client.rb +64 -48
- data/lib/sidekiq/delay.rb +5 -6
- data/lib/sidekiq/exception_handler.rb +10 -12
- data/lib/sidekiq/extensions/action_mailer.rb +13 -22
- data/lib/sidekiq/extensions/active_record.rb +13 -10
- data/lib/sidekiq/extensions/class_methods.rb +14 -11
- data/lib/sidekiq/extensions/generic_proxy.rb +4 -4
- data/lib/sidekiq/fetch.rb +38 -31
- data/lib/sidekiq/job_logger.rb +45 -7
- data/lib/sidekiq/job_retry.rb +62 -61
- data/lib/sidekiq/launcher.rb +142 -52
- data/lib/sidekiq/logger.rb +166 -0
- data/lib/sidekiq/manager.rb +11 -13
- data/lib/sidekiq/middleware/chain.rb +15 -5
- data/lib/sidekiq/middleware/i18n.rb +5 -7
- data/lib/sidekiq/monitor.rb +133 -0
- data/lib/sidekiq/paginator.rb +18 -14
- data/lib/sidekiq/processor.rb +71 -70
- data/lib/sidekiq/rails.rb +29 -37
- data/lib/sidekiq/redis_connection.rb +50 -48
- data/lib/sidekiq/scheduled.rb +28 -29
- data/lib/sidekiq/sd_notify.rb +149 -0
- data/lib/sidekiq/systemd.rb +24 -0
- data/lib/sidekiq/testing/inline.rb +2 -1
- data/lib/sidekiq/testing.rb +35 -24
- data/lib/sidekiq/util.rb +45 -16
- data/lib/sidekiq/version.rb +2 -1
- data/lib/sidekiq/web/action.rb +15 -11
- data/lib/sidekiq/web/application.rb +84 -74
- data/lib/sidekiq/web/csrf_protection.rb +180 -0
- data/lib/sidekiq/web/helpers.rb +108 -79
- data/lib/sidekiq/web/router.rb +23 -19
- data/lib/sidekiq/web.rb +60 -105
- data/lib/sidekiq/worker.rb +126 -102
- data/lib/sidekiq.rb +69 -44
- data/sidekiq.gemspec +23 -16
- data/web/assets/images/apple-touch-icon.png +0 -0
- data/web/assets/javascripts/application.js +25 -27
- data/web/assets/javascripts/dashboard.js +4 -23
- data/web/assets/stylesheets/application-dark.css +160 -0
- data/web/assets/stylesheets/application.css +33 -8
- data/web/locales/de.yml +14 -2
- data/web/locales/en.yml +2 -0
- data/web/locales/fr.yml +3 -3
- data/web/locales/ja.yml +4 -1
- data/web/locales/lt.yml +83 -0
- data/web/locales/pl.yml +4 -4
- data/web/locales/ru.yml +4 -0
- data/web/locales/vi.yml +83 -0
- data/web/views/_job_info.erb +2 -1
- data/web/views/busy.erb +51 -17
- data/web/views/dead.erb +2 -2
- data/web/views/layout.erb +2 -0
- data/web/views/morgue.erb +5 -2
- data/web/views/queue.erb +11 -2
- data/web/views/queues.erb +9 -1
- data/web/views/retries.erb +5 -2
- data/web/views/retry.erb +2 -2
- data/web/views/scheduled.erb +5 -2
- metadata +27 -60
- data/.circleci/config.yml +0 -61
- data/.github/contributing.md +0 -32
- data/.github/issue_template.md +0 -11
- data/.gitignore +0 -15
- data/.travis.yml +0 -11
- data/3.0-Upgrade.md +0 -70
- data/4.0-Upgrade.md +0 -53
- data/5.0-Upgrade.md +0 -56
- data/COMM-LICENSE +0 -97
- data/Ent-Changes.md +0 -238
- data/Gemfile +0 -23
- data/Pro-2.0-Upgrade.md +0 -138
- data/Pro-3.0-Upgrade.md +0 -44
- data/Pro-4.0-Upgrade.md +0 -35
- data/Pro-Changes.md +0 -759
- data/Rakefile +0 -9
- data/bin/sidekiqctl +0 -20
- data/code_of_conduct.md +0 -50
- data/lib/sidekiq/core_ext.rb +0 -1
- data/lib/sidekiq/ctl.rb +0 -221
- data/lib/sidekiq/logging.rb +0 -122
- data/lib/sidekiq/middleware/server/active_record.rb +0 -23
data/lib/sidekiq.rb
CHANGED
@@ -1,27 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.
|
3
|
+
require "sidekiq/version"
|
4
|
+
fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.5.0." if RUBY_PLATFORM != "java" && Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5.0")
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
6
|
+
require "sidekiq/logger"
|
7
|
+
require "sidekiq/client"
|
8
|
+
require "sidekiq/worker"
|
9
|
+
require "sidekiq/redis_connection"
|
10
|
+
require "sidekiq/delay"
|
11
11
|
|
12
|
-
require
|
12
|
+
require "json"
|
13
13
|
|
14
14
|
module Sidekiq
|
15
|
-
NAME =
|
16
|
-
LICENSE =
|
15
|
+
NAME = "Sidekiq"
|
16
|
+
LICENSE = "See LICENSE and the LGPL-3.0 for licensing details."
|
17
17
|
|
18
18
|
DEFAULTS = {
|
19
19
|
queues: [],
|
20
20
|
labels: [],
|
21
21
|
concurrency: 10,
|
22
|
-
require:
|
22
|
+
require: ".",
|
23
|
+
strict: true,
|
23
24
|
environment: nil,
|
24
|
-
timeout:
|
25
|
+
timeout: 25,
|
25
26
|
poll_interval_average: nil,
|
26
27
|
average_scheduled_poll_interval: 5,
|
27
28
|
error_handlers: [],
|
@@ -30,16 +31,16 @@ module Sidekiq
|
|
30
31
|
startup: [],
|
31
32
|
quiet: [],
|
32
33
|
shutdown: [],
|
33
|
-
heartbeat: []
|
34
|
+
heartbeat: []
|
34
35
|
},
|
35
36
|
dead_max_jobs: 10_000,
|
36
37
|
dead_timeout_in_seconds: 180 * 24 * 60 * 60, # 6 months
|
37
|
-
reloader: proc { |&block| block.call }
|
38
|
+
reloader: proc { |&block| block.call }
|
38
39
|
}
|
39
40
|
|
40
41
|
DEFAULT_WORKER_OPTIONS = {
|
41
|
-
|
42
|
-
|
42
|
+
"retry" => true,
|
43
|
+
"queue" => "default"
|
43
44
|
}
|
44
45
|
|
45
46
|
FAKE_INFO = {
|
@@ -95,10 +96,15 @@ module Sidekiq
|
|
95
96
|
retryable = true
|
96
97
|
begin
|
97
98
|
yield conn
|
98
|
-
rescue Redis::
|
99
|
-
#2550 Failover can cause the server to become a replica, need
|
99
|
+
rescue Redis::BaseError => ex
|
100
|
+
# 2550 Failover can cause the server to become a replica, need
|
100
101
|
# to disconnect and reopen the socket to get back to the primary.
|
101
|
-
|
102
|
+
# 4495 Use the same logic if we have a "Not enough replicas" error from the primary
|
103
|
+
if retryable && ex.message =~ /READONLY|NOREPLICAS/
|
104
|
+
conn.disconnect!
|
105
|
+
retryable = false
|
106
|
+
retry
|
107
|
+
end
|
102
108
|
raise
|
103
109
|
end
|
104
110
|
end
|
@@ -106,19 +112,17 @@ module Sidekiq
|
|
106
112
|
|
107
113
|
def self.redis_info
|
108
114
|
redis do |conn|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
conn.info
|
116
|
-
end
|
117
|
-
rescue Redis::CommandError => ex
|
118
|
-
#2850 return fake version when INFO command has (probably) been renamed
|
119
|
-
raise unless ex.message =~ /unknown command/
|
120
|
-
FAKE_INFO
|
115
|
+
# admin commands can't go through redis-namespace starting
|
116
|
+
# in redis-namespace 2.0
|
117
|
+
if conn.respond_to?(:namespace)
|
118
|
+
conn.redis.info
|
119
|
+
else
|
120
|
+
conn.info
|
121
121
|
end
|
122
|
+
rescue Redis::CommandError => ex
|
123
|
+
# 2850 return fake version when INFO command has (probably) been renamed
|
124
|
+
raise unless /unknown command/.match?(ex.message)
|
125
|
+
FAKE_INFO
|
122
126
|
end
|
123
127
|
end
|
124
128
|
|
@@ -152,18 +156,13 @@ module Sidekiq
|
|
152
156
|
|
153
157
|
def self.default_worker_options=(hash)
|
154
158
|
# stringify
|
155
|
-
@default_worker_options = default_worker_options.merge(
|
159
|
+
@default_worker_options = default_worker_options.merge(hash.transform_keys(&:to_s))
|
156
160
|
end
|
161
|
+
|
157
162
|
def self.default_worker_options
|
158
163
|
defined?(@default_worker_options) ? @default_worker_options : DEFAULT_WORKER_OPTIONS
|
159
164
|
end
|
160
165
|
|
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
166
|
##
|
168
167
|
# Death handlers are called when all retries for a job have been exhausted and
|
169
168
|
# the job dies. It's the notification to your application
|
@@ -180,15 +179,41 @@ module Sidekiq
|
|
180
179
|
def self.load_json(string)
|
181
180
|
JSON.parse(string)
|
182
181
|
end
|
182
|
+
|
183
183
|
def self.dump_json(object)
|
184
184
|
JSON.generate(object)
|
185
185
|
end
|
186
186
|
|
187
|
+
def self.log_formatter
|
188
|
+
@log_formatter ||= if ENV["DYNO"]
|
189
|
+
Sidekiq::Logger::Formatters::WithoutTimestamp.new
|
190
|
+
else
|
191
|
+
Sidekiq::Logger::Formatters::Pretty.new
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def self.log_formatter=(log_formatter)
|
196
|
+
@log_formatter = log_formatter
|
197
|
+
logger.formatter = log_formatter
|
198
|
+
end
|
199
|
+
|
187
200
|
def self.logger
|
188
|
-
Sidekiq::
|
201
|
+
@logger ||= Sidekiq::Logger.new($stdout, level: Logger::INFO)
|
189
202
|
end
|
190
|
-
|
191
|
-
|
203
|
+
|
204
|
+
def self.logger=(logger)
|
205
|
+
if logger.nil?
|
206
|
+
self.logger.level = Logger::FATAL
|
207
|
+
return self.logger
|
208
|
+
end
|
209
|
+
|
210
|
+
logger.extend(Sidekiq::LoggingUtils)
|
211
|
+
|
212
|
+
@logger = logger
|
213
|
+
end
|
214
|
+
|
215
|
+
def self.pro?
|
216
|
+
defined?(Sidekiq::Pro)
|
192
217
|
end
|
193
218
|
|
194
219
|
# How frequently Redis should be checked by a random Sidekiq process for
|
@@ -197,7 +222,7 @@ module Sidekiq
|
|
197
222
|
#
|
198
223
|
# See sidekiq/scheduled.rb for an in-depth explanation of this value
|
199
224
|
def self.average_scheduled_poll_interval=(interval)
|
200
|
-
|
225
|
+
options[:average_scheduled_poll_interval] = interval
|
201
226
|
end
|
202
227
|
|
203
228
|
# Register a proc to handle any error which occurs within the Sidekiq process.
|
@@ -208,7 +233,7 @@ module Sidekiq
|
|
208
233
|
#
|
209
234
|
# The default error handler logs errors to Sidekiq.logger.
|
210
235
|
def self.error_handlers
|
211
|
-
|
236
|
+
options[:error_handlers]
|
212
237
|
end
|
213
238
|
|
214
239
|
# Register a block to run at a point in the Sidekiq lifecycle.
|
@@ -234,4 +259,4 @@ module Sidekiq
|
|
234
259
|
class Shutdown < Interrupt; end
|
235
260
|
end
|
236
261
|
|
237
|
-
require
|
262
|
+
require "sidekiq/rails" if defined?(::Rails::Engine)
|
data/sidekiq.gemspec
CHANGED
@@ -1,21 +1,28 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "lib/sidekiq/version"
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.authors
|
5
|
-
gem.email
|
6
|
-
gem.summary
|
7
|
-
gem.description
|
8
|
-
gem.homepage
|
9
|
-
gem.license
|
4
|
+
gem.authors = ["Mike Perham"]
|
5
|
+
gem.email = ["mperham@gmail.com"]
|
6
|
+
gem.summary = "Simple, efficient background processing for Ruby"
|
7
|
+
gem.description = "Simple, efficient background processing for Ruby."
|
8
|
+
gem.homepage = "https://sidekiq.org"
|
9
|
+
gem.license = "LGPL-3.0"
|
10
10
|
|
11
|
-
gem.executables
|
12
|
-
gem.files
|
13
|
-
gem.name
|
14
|
-
gem.version
|
15
|
-
gem.required_ruby_version = ">= 2.
|
11
|
+
gem.executables = ["sidekiq", "sidekiqmon"]
|
12
|
+
gem.files = ["sidekiq.gemspec", "README.md", "Changes.md", "LICENSE"] + `git ls-files | grep -E '^(bin|lib|web)'`.split("\n")
|
13
|
+
gem.name = "sidekiq"
|
14
|
+
gem.version = Sidekiq::VERSION
|
15
|
+
gem.required_ruby_version = ">= 2.5.0"
|
16
16
|
|
17
|
-
gem.
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
gem.metadata = {
|
18
|
+
"homepage_uri" => "https://sidekiq.org",
|
19
|
+
"bug_tracker_uri" => "https://github.com/mperham/sidekiq/issues",
|
20
|
+
"documentation_uri" => "https://github.com/mperham/sidekiq/wiki",
|
21
|
+
"changelog_uri" => "https://github.com/mperham/sidekiq/blob/master/Changes.md",
|
22
|
+
"source_code_uri" => "https://github.com/mperham/sidekiq"
|
23
|
+
}
|
24
|
+
|
25
|
+
gem.add_dependency "redis", ">= 4.2.0"
|
26
|
+
gem.add_dependency "connection_pool", ">= 2.2.2"
|
27
|
+
gem.add_dependency "rack", "~> 2.0"
|
21
28
|
end
|
Binary file
|