sidekiq 6.2.2 → 7.1.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.
- checksums.yaml +4 -4
- data/Changes.md +299 -11
- data/LICENSE.txt +9 -0
- data/README.md +45 -32
- data/bin/sidekiq +4 -9
- data/bin/sidekiqload +207 -117
- data/bin/sidekiqmon +4 -1
- data/lib/generators/sidekiq/job_generator.rb +57 -0
- data/lib/generators/sidekiq/templates/{worker.rb.erb → job.rb.erb} +2 -2
- data/lib/generators/sidekiq/templates/{worker_spec.rb.erb → job_spec.rb.erb} +1 -1
- data/lib/generators/sidekiq/templates/{worker_test.rb.erb → job_test.rb.erb} +1 -1
- data/lib/sidekiq/api.rb +334 -190
- data/lib/sidekiq/capsule.rb +127 -0
- data/lib/sidekiq/cli.rb +95 -81
- data/lib/sidekiq/client.rb +102 -96
- data/lib/sidekiq/{util.rb → component.rb} +14 -41
- data/lib/sidekiq/config.rb +278 -0
- data/lib/sidekiq/deploy.rb +62 -0
- data/lib/sidekiq/embedded.rb +61 -0
- data/lib/sidekiq/fetch.rb +26 -26
- data/lib/sidekiq/job.rb +371 -5
- data/lib/sidekiq/job_logger.rb +16 -28
- data/lib/sidekiq/job_retry.rb +85 -59
- data/lib/sidekiq/job_util.rb +105 -0
- data/lib/sidekiq/launcher.rb +106 -94
- data/lib/sidekiq/logger.rb +9 -44
- data/lib/sidekiq/manager.rb +40 -41
- data/lib/sidekiq/metrics/query.rb +153 -0
- data/lib/sidekiq/metrics/shared.rb +95 -0
- data/lib/sidekiq/metrics/tracking.rb +136 -0
- data/lib/sidekiq/middleware/chain.rb +96 -51
- data/lib/sidekiq/middleware/current_attributes.rb +95 -0
- data/lib/sidekiq/middleware/i18n.rb +6 -4
- data/lib/sidekiq/middleware/modules.rb +21 -0
- data/lib/sidekiq/monitor.rb +17 -4
- data/lib/sidekiq/paginator.rb +17 -9
- data/lib/sidekiq/processor.rb +60 -60
- data/lib/sidekiq/rails.rb +29 -6
- data/lib/sidekiq/redis_client_adapter.rb +96 -0
- data/lib/sidekiq/redis_connection.rb +17 -88
- data/lib/sidekiq/ring_buffer.rb +29 -0
- data/lib/sidekiq/scheduled.rb +101 -44
- data/lib/sidekiq/testing/inline.rb +4 -4
- data/lib/sidekiq/testing.rb +41 -68
- data/lib/sidekiq/transaction_aware_client.rb +44 -0
- data/lib/sidekiq/version.rb +2 -1
- data/lib/sidekiq/web/action.rb +3 -3
- data/lib/sidekiq/web/application.rb +47 -13
- data/lib/sidekiq/web/csrf_protection.rb +3 -3
- data/lib/sidekiq/web/helpers.rb +36 -33
- data/lib/sidekiq/web.rb +10 -17
- data/lib/sidekiq/worker_compatibility_alias.rb +13 -0
- data/lib/sidekiq.rb +86 -201
- data/sidekiq.gemspec +12 -10
- data/web/assets/javascripts/application.js +131 -60
- data/web/assets/javascripts/base-charts.js +106 -0
- data/web/assets/javascripts/chart.min.js +13 -0
- data/web/assets/javascripts/chartjs-plugin-annotation.min.js +7 -0
- data/web/assets/javascripts/dashboard-charts.js +166 -0
- data/web/assets/javascripts/dashboard.js +36 -273
- data/web/assets/javascripts/metrics.js +264 -0
- data/web/assets/stylesheets/application-dark.css +23 -23
- data/web/assets/stylesheets/application-rtl.css +2 -95
- data/web/assets/stylesheets/application.css +73 -402
- data/web/locales/ar.yml +70 -70
- data/web/locales/cs.yml +62 -62
- data/web/locales/da.yml +60 -53
- data/web/locales/de.yml +65 -65
- data/web/locales/el.yml +43 -24
- data/web/locales/en.yml +82 -69
- data/web/locales/es.yml +68 -68
- data/web/locales/fa.yml +65 -65
- data/web/locales/fr.yml +81 -67
- data/web/locales/gd.yml +99 -0
- data/web/locales/he.yml +65 -64
- data/web/locales/hi.yml +59 -59
- data/web/locales/it.yml +53 -53
- data/web/locales/ja.yml +73 -68
- data/web/locales/ko.yml +52 -52
- data/web/locales/lt.yml +66 -66
- data/web/locales/nb.yml +61 -61
- data/web/locales/nl.yml +52 -52
- data/web/locales/pl.yml +45 -45
- data/web/locales/pt-br.yml +63 -55
- data/web/locales/pt.yml +51 -51
- data/web/locales/ru.yml +67 -66
- data/web/locales/sv.yml +53 -53
- data/web/locales/ta.yml +60 -60
- data/web/locales/uk.yml +62 -61
- data/web/locales/ur.yml +64 -64
- data/web/locales/vi.yml +67 -67
- data/web/locales/zh-cn.yml +43 -16
- data/web/locales/zh-tw.yml +42 -8
- data/web/views/_footer.erb +6 -3
- data/web/views/_job_info.erb +18 -2
- data/web/views/_metrics_period_select.erb +12 -0
- data/web/views/_nav.erb +1 -1
- data/web/views/_paging.erb +2 -0
- data/web/views/_poll_link.erb +3 -6
- data/web/views/_summary.erb +7 -7
- data/web/views/busy.erb +44 -28
- data/web/views/dashboard.erb +44 -12
- data/web/views/layout.erb +1 -1
- data/web/views/metrics.erb +82 -0
- data/web/views/metrics_for_job.erb +68 -0
- data/web/views/morgue.erb +5 -9
- data/web/views/queue.erb +24 -24
- data/web/views/queues.erb +4 -2
- data/web/views/retries.erb +5 -9
- data/web/views/scheduled.erb +12 -13
- metadata +62 -31
- data/LICENSE +0 -9
- data/lib/generators/sidekiq/worker_generator.rb +0 -57
- data/lib/sidekiq/delay.rb +0 -41
- data/lib/sidekiq/exception_handler.rb +0 -27
- data/lib/sidekiq/extensions/action_mailer.rb +0 -48
- data/lib/sidekiq/extensions/active_record.rb +0 -43
- data/lib/sidekiq/extensions/class_methods.rb +0 -43
- data/lib/sidekiq/extensions/generic_proxy.rb +0 -33
- data/lib/sidekiq/worker.rb +0 -244
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "securerandom"
|
4
|
+
require "sidekiq/client"
|
5
|
+
|
6
|
+
module Sidekiq
|
7
|
+
class TransactionAwareClient
|
8
|
+
def initialize(pool: nil, config: nil)
|
9
|
+
@redis_client = Client.new(pool: pool, config: config)
|
10
|
+
end
|
11
|
+
|
12
|
+
def push(item)
|
13
|
+
# pre-allocate the JID so we can return it immediately and
|
14
|
+
# save it to the database as part of the transaction.
|
15
|
+
item["jid"] ||= SecureRandom.hex(12)
|
16
|
+
AfterCommitEverywhere.after_commit { @redis_client.push(item) }
|
17
|
+
item["jid"]
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# We don't provide transactionality for push_bulk because we don't want
|
22
|
+
# to hold potentially hundreds of thousands of job records in memory due to
|
23
|
+
# a long running enqueue process.
|
24
|
+
def push_bulk(items)
|
25
|
+
@redis_client.push_bulk(items)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Use `Sidekiq.transactional_push!` in your sidekiq.rb initializer
|
32
|
+
module Sidekiq
|
33
|
+
def self.transactional_push!
|
34
|
+
begin
|
35
|
+
require "after_commit_everywhere"
|
36
|
+
rescue LoadError
|
37
|
+
raise %q(You need to add `gem "after_commit_everywhere"` to your Gemfile to use Sidekiq's transactional client)
|
38
|
+
end
|
39
|
+
|
40
|
+
Sidekiq.default_job_options["client_class"] = Sidekiq::TransactionAwareClient
|
41
|
+
Sidekiq::JobUtil::TRANSIENT_ATTRIBUTES << "client_class"
|
42
|
+
true
|
43
|
+
end
|
44
|
+
end
|
data/lib/sidekiq/version.rb
CHANGED
data/lib/sidekiq/web/action.rb
CHANGED
@@ -15,11 +15,11 @@ module Sidekiq
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def halt(res)
|
18
|
-
throw :halt, [res, {"
|
18
|
+
throw :halt, [res, {"content-type" => "text/plain"}, [res.to_s]]
|
19
19
|
end
|
20
20
|
|
21
21
|
def redirect(location)
|
22
|
-
throw :halt, [302, {"
|
22
|
+
throw :halt, [302, {"location" => "#{request.base_url}#{location}"}, []]
|
23
23
|
end
|
24
24
|
|
25
25
|
def params
|
@@ -68,7 +68,7 @@ module Sidekiq
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def json(payload)
|
71
|
-
[200, {"
|
71
|
+
[200, {"content-type" => "application/json", "cache-control" => "private, no-store"}, [Sidekiq.dump_json(payload)]]
|
72
72
|
end
|
73
73
|
|
74
74
|
def initialize(env, block)
|
@@ -20,6 +20,12 @@ module Sidekiq
|
|
20
20
|
"worker-src 'self'",
|
21
21
|
"base-uri 'self'"
|
22
22
|
].join("; ").freeze
|
23
|
+
METRICS_PERIODS = {
|
24
|
+
"1h" => 60,
|
25
|
+
"2h" => 120,
|
26
|
+
"4h" => 240,
|
27
|
+
"8h" => 480
|
28
|
+
}
|
23
29
|
|
24
30
|
def initialize(klass)
|
25
31
|
@klass = klass
|
@@ -50,24 +56,52 @@ module Sidekiq
|
|
50
56
|
|
51
57
|
get "/" do
|
52
58
|
@redis_info = redis_info.select { |k, v| REDIS_KEYS.include? k }
|
53
|
-
|
59
|
+
days = (params["days"] || 30).to_i
|
60
|
+
return halt(401) if days < 1 || days > 180
|
61
|
+
|
62
|
+
stats_history = Sidekiq::Stats::History.new(days)
|
54
63
|
@processed_history = stats_history.processed
|
55
64
|
@failed_history = stats_history.failed
|
56
65
|
|
57
66
|
erb(:dashboard)
|
58
67
|
end
|
59
68
|
|
69
|
+
get "/metrics" do
|
70
|
+
q = Sidekiq::Metrics::Query.new
|
71
|
+
@period = h((params[:period] || "")[0..1])
|
72
|
+
@periods = METRICS_PERIODS
|
73
|
+
minutes = @periods.fetch(@period, @periods.values.first)
|
74
|
+
@query_result = q.top_jobs(minutes: minutes)
|
75
|
+
erb(:metrics)
|
76
|
+
end
|
77
|
+
|
78
|
+
get "/metrics/:name" do
|
79
|
+
@name = route_params[:name]
|
80
|
+
@period = h((params[:period] || "")[0..1])
|
81
|
+
q = Sidekiq::Metrics::Query.new
|
82
|
+
@periods = METRICS_PERIODS
|
83
|
+
minutes = @periods.fetch(@period, @periods.values.first)
|
84
|
+
@query_result = q.for_job(@name, minutes: minutes)
|
85
|
+
erb(:metrics_for_job)
|
86
|
+
end
|
87
|
+
|
60
88
|
get "/busy" do
|
89
|
+
@count = (params["count"] || 100).to_i
|
90
|
+
(@current_page, @total_size, @workset) = page_items(workset, params["page"], @count)
|
91
|
+
|
61
92
|
erb(:busy)
|
62
93
|
end
|
63
94
|
|
64
95
|
post "/busy" do
|
65
96
|
if params["identity"]
|
66
|
-
|
67
|
-
|
68
|
-
|
97
|
+
pro = Sidekiq::ProcessSet[params["identity"]]
|
98
|
+
|
99
|
+
pro.quiet! if params["quiet"]
|
100
|
+
pro.stop! if params["stop"]
|
69
101
|
else
|
70
102
|
processes.each do |pro|
|
103
|
+
next if pro.embedded?
|
104
|
+
|
71
105
|
pro.quiet! if params["quiet"]
|
72
106
|
pro.stop! if params["stop"]
|
73
107
|
end
|
@@ -91,8 +125,8 @@ module Sidekiq
|
|
91
125
|
|
92
126
|
@count = (params["count"] || 25).to_i
|
93
127
|
@queue = Sidekiq::Queue.new(@name)
|
94
|
-
(@current_page, @total_size, @
|
95
|
-
@
|
128
|
+
(@current_page, @total_size, @jobs) = page("queue:#{@name}", params["page"], @count, reverse: params["direction"] == "asc")
|
129
|
+
@jobs = @jobs.map { |msg| Sidekiq::JobRecord.new(msg, @name) }
|
96
130
|
|
97
131
|
erb(:queue)
|
98
132
|
end
|
@@ -291,15 +325,15 @@ module Sidekiq
|
|
291
325
|
end
|
292
326
|
|
293
327
|
get "/stats/queues" do
|
294
|
-
json Sidekiq::Stats
|
328
|
+
json Sidekiq::Stats.new.queues
|
295
329
|
end
|
296
330
|
|
297
331
|
def call(env)
|
298
332
|
action = self.class.match(env)
|
299
|
-
return [404, {"
|
333
|
+
return [404, {"content-type" => "text/plain", "x-cascade" => "pass"}, ["Not Found"]] unless action
|
300
334
|
|
301
335
|
app = @klass
|
302
|
-
resp = catch(:halt) do
|
336
|
+
resp = catch(:halt) do
|
303
337
|
self.class.run_befores(app, action)
|
304
338
|
action.instance_exec env, &action.block
|
305
339
|
ensure
|
@@ -313,10 +347,10 @@ module Sidekiq
|
|
313
347
|
else
|
314
348
|
# rendered content goes here
|
315
349
|
headers = {
|
316
|
-
"
|
317
|
-
"
|
318
|
-
"
|
319
|
-
"
|
350
|
+
"content-type" => "text/html",
|
351
|
+
"cache-control" => "private, no-store",
|
352
|
+
"content-language" => action.locale,
|
353
|
+
"content-security-policy" => CSP_HEADER
|
320
354
|
}
|
321
355
|
# we'll let Rack calculate Content-Length for us.
|
322
356
|
[200, headers, [resp]]
|
@@ -143,7 +143,7 @@ module Sidekiq
|
|
143
143
|
one_time_pad = SecureRandom.random_bytes(token.length)
|
144
144
|
encrypted_token = xor_byte_strings(one_time_pad, token)
|
145
145
|
masked_token = one_time_pad + encrypted_token
|
146
|
-
Base64.
|
146
|
+
Base64.urlsafe_encode64(masked_token)
|
147
147
|
end
|
148
148
|
|
149
149
|
# Essentially the inverse of +mask_token+.
|
@@ -152,7 +152,7 @@ module Sidekiq
|
|
152
152
|
# value and decrypt it
|
153
153
|
token_length = masked_token.length / 2
|
154
154
|
one_time_pad = masked_token[0...token_length]
|
155
|
-
encrypted_token = masked_token[token_length
|
155
|
+
encrypted_token = masked_token[token_length..]
|
156
156
|
xor_byte_strings(one_time_pad, encrypted_token)
|
157
157
|
end
|
158
158
|
|
@@ -169,7 +169,7 @@ module Sidekiq
|
|
169
169
|
end
|
170
170
|
|
171
171
|
def decode_token(token)
|
172
|
-
Base64.
|
172
|
+
Base64.urlsafe_decode64(token)
|
173
173
|
end
|
174
174
|
|
175
175
|
def xor_byte_strings(s1, s2)
|
data/lib/sidekiq/web/helpers.rb
CHANGED
@@ -15,7 +15,7 @@ module Sidekiq
|
|
15
15
|
# so extensions can be localized
|
16
16
|
@strings[lang] ||= settings.locales.each_with_object({}) do |path, global|
|
17
17
|
find_locale_files(lang).each do |file|
|
18
|
-
strs = YAML.
|
18
|
+
strs = YAML.safe_load(File.read(file))
|
19
19
|
global.merge!(strs[lang])
|
20
20
|
end
|
21
21
|
end
|
@@ -70,17 +70,6 @@ module Sidekiq
|
|
70
70
|
@head_html.join if defined?(@head_html)
|
71
71
|
end
|
72
72
|
|
73
|
-
def poll_path
|
74
|
-
if current_path != "" && params["poll"]
|
75
|
-
path = root_path + current_path
|
76
|
-
query_string = to_query_string(params.slice(*params.keys - %w[page poll]))
|
77
|
-
path += "?#{query_string}" unless query_string.empty?
|
78
|
-
path
|
79
|
-
else
|
80
|
-
""
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
73
|
def text_direction
|
85
74
|
get_locale["TextDirection"] || "ltr"
|
86
75
|
end
|
@@ -129,7 +118,7 @@ module Sidekiq
|
|
129
118
|
}.join(" ")
|
130
119
|
end
|
131
120
|
|
132
|
-
#
|
121
|
+
# sidekiq/sidekiq#3243
|
133
122
|
def unfiltered?
|
134
123
|
yield unless env["PATH_INFO"].start_with?("/filter/")
|
135
124
|
end
|
@@ -148,33 +137,50 @@ module Sidekiq
|
|
148
137
|
end
|
149
138
|
|
150
139
|
def sort_direction_label
|
151
|
-
params[:direction] == "asc" ? "↑" : "↓"
|
140
|
+
(params[:direction] == "asc") ? "↑" : "↓"
|
152
141
|
end
|
153
142
|
|
154
|
-
def
|
155
|
-
@
|
143
|
+
def workset
|
144
|
+
@work ||= Sidekiq::WorkSet.new
|
156
145
|
end
|
157
146
|
|
158
147
|
def processes
|
159
148
|
@processes ||= Sidekiq::ProcessSet.new
|
160
149
|
end
|
161
150
|
|
151
|
+
# Sorts processes by hostname following the natural sort order
|
152
|
+
def sorted_processes
|
153
|
+
@sorted_processes ||= begin
|
154
|
+
return processes unless processes.all? { |p| p["hostname"] }
|
155
|
+
|
156
|
+
processes.to_a.sort_by do |process|
|
157
|
+
# Kudos to `shurikk` on StackOverflow
|
158
|
+
# https://stackoverflow.com/a/15170063/575547
|
159
|
+
process["hostname"].split(/(\d+)/).map { |a| /\d+/.match?(a) ? a.to_i : a }
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def busy_weights(capsule_weights)
|
165
|
+
# backwards compat with 7.0.0, remove in 7.1
|
166
|
+
cw = [capsule_weights].flatten
|
167
|
+
cw.map { |hash|
|
168
|
+
hash.map { |name, weight| (weight > 0) ? +name << ": " << weight.to_s : name }.join(", ")
|
169
|
+
}.join("; ")
|
170
|
+
end
|
171
|
+
|
162
172
|
def stats
|
163
173
|
@stats ||= Sidekiq::Stats.new
|
164
174
|
end
|
165
175
|
|
166
|
-
def
|
176
|
+
def redis_url
|
167
177
|
Sidekiq.redis do |conn|
|
168
|
-
conn.
|
178
|
+
conn.config.server_url
|
169
179
|
end
|
170
180
|
end
|
171
181
|
|
172
|
-
def namespace
|
173
|
-
@ns ||= Sidekiq.redis { |conn| conn.respond_to?(:namespace) ? conn.namespace : nil }
|
174
|
-
end
|
175
|
-
|
176
182
|
def redis_info
|
177
|
-
Sidekiq.redis_info
|
183
|
+
Sidekiq.default_configuration.redis_info
|
178
184
|
end
|
179
185
|
|
180
186
|
def root_path
|
@@ -186,7 +192,7 @@ module Sidekiq
|
|
186
192
|
end
|
187
193
|
|
188
194
|
def current_status
|
189
|
-
|
195
|
+
(workset.size == 0) ? "idle" : "active"
|
190
196
|
end
|
191
197
|
|
192
198
|
def relative_time(time)
|
@@ -203,7 +209,7 @@ module Sidekiq
|
|
203
209
|
[score.to_f, jid]
|
204
210
|
end
|
205
211
|
|
206
|
-
SAFE_QPARAMS = %w[page
|
212
|
+
SAFE_QPARAMS = %w[page direction]
|
207
213
|
|
208
214
|
# Merge options with current params, filter safe params, and stringify to query string
|
209
215
|
def qparams(options)
|
@@ -219,7 +225,7 @@ module Sidekiq
|
|
219
225
|
end
|
220
226
|
|
221
227
|
def truncate(text, truncate_after_chars = 2000)
|
222
|
-
truncate_after_chars && text.size > truncate_after_chars ? "#{text[0..truncate_after_chars]}..." : text
|
228
|
+
(truncate_after_chars && text.size > truncate_after_chars) ? "#{text[0..truncate_after_chars]}..." : text
|
223
229
|
end
|
224
230
|
|
225
231
|
def display_args(args, truncate_after_chars = 2000)
|
@@ -253,7 +259,7 @@ module Sidekiq
|
|
253
259
|
queue class args retry_count retried_at failed_at
|
254
260
|
jid error_message error_class backtrace
|
255
261
|
error_backtrace enqueued_at retry wrapped
|
256
|
-
created_at tags
|
262
|
+
created_at tags display_class
|
257
263
|
])
|
258
264
|
|
259
265
|
def retry_extra_items(retry_job)
|
@@ -312,7 +318,7 @@ module Sidekiq
|
|
312
318
|
end
|
313
319
|
|
314
320
|
def environment_title_prefix
|
315
|
-
environment = Sidekiq.
|
321
|
+
environment = Sidekiq.default_configuration[:environment] || ENV["APP_ENV"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
|
316
322
|
|
317
323
|
"[#{environment.upcase}] " unless environment == "production"
|
318
324
|
end
|
@@ -325,11 +331,8 @@ module Sidekiq
|
|
325
331
|
Time.now.utc.strftime("%H:%M:%S UTC")
|
326
332
|
end
|
327
333
|
|
328
|
-
def
|
329
|
-
|
330
|
-
namespace_suffix = namespace.nil? ? "" : "##{namespace}"
|
331
|
-
"#{redis_connection}#{namespace_suffix}"
|
332
|
-
end
|
334
|
+
def pollable?
|
335
|
+
!(current_path == "" || current_path.start_with?("metrics"))
|
333
336
|
end
|
334
337
|
|
335
338
|
def retry_or_delete_or_kill(job, params)
|
data/lib/sidekiq/web.rb
CHANGED
@@ -30,7 +30,8 @@ module Sidekiq
|
|
30
30
|
"Queues" => "queues",
|
31
31
|
"Retries" => "retries",
|
32
32
|
"Scheduled" => "scheduled",
|
33
|
-
"Dead" => "morgue"
|
33
|
+
"Dead" => "morgue",
|
34
|
+
"Metrics" => "metrics"
|
34
35
|
}
|
35
36
|
|
36
37
|
class << self
|
@@ -47,6 +48,10 @@ module Sidekiq
|
|
47
48
|
end
|
48
49
|
alias_method :tabs, :custom_tabs
|
49
50
|
|
51
|
+
def custom_job_info_rows
|
52
|
+
@custom_job_info_rows ||= []
|
53
|
+
end
|
54
|
+
|
50
55
|
def locales
|
51
56
|
@locales ||= LOCALES
|
52
57
|
end
|
@@ -75,14 +80,6 @@ module Sidekiq
|
|
75
80
|
send(:"#{attribute}=", value)
|
76
81
|
end
|
77
82
|
|
78
|
-
def sessions=(val)
|
79
|
-
puts "WARNING: Sidekiq::Web.sessions= is no longer relevant and will be removed in Sidekiq 7.0. #{caller(1..1).first}"
|
80
|
-
end
|
81
|
-
|
82
|
-
def session_secret=(val)
|
83
|
-
puts "WARNING: Sidekiq::Web.session_secret= is no longer relevant and will be removed in Sidekiq 7.0. #{caller(1..1).first}"
|
84
|
-
end
|
85
|
-
|
86
83
|
attr_accessor :app_url, :redis_pool
|
87
84
|
attr_writer :locales, :views
|
88
85
|
end
|
@@ -129,10 +126,6 @@ module Sidekiq
|
|
129
126
|
send(:"#{attribute}=", value)
|
130
127
|
end
|
131
128
|
|
132
|
-
def sessions=(val)
|
133
|
-
puts "Sidekiq::Web#sessions= is no longer relevant and will be removed in Sidekiq 7.0. #{caller[2..2].first}"
|
134
|
-
end
|
135
|
-
|
136
129
|
def self.register(extension)
|
137
130
|
extension.registered(WebApplication)
|
138
131
|
end
|
@@ -144,13 +137,13 @@ module Sidekiq
|
|
144
137
|
m = middlewares
|
145
138
|
|
146
139
|
rules = []
|
147
|
-
rules = [[:all, {"Cache-Control" => "
|
140
|
+
rules = [[:all, {"Cache-Control" => "private, max-age=86400"}]] unless ENV["SIDEKIQ_WEB_TESTING"]
|
148
141
|
|
149
142
|
::Rack::Builder.new do
|
150
143
|
use Rack::Static, urls: ["/stylesheets", "/images", "/javascripts"],
|
151
|
-
|
152
|
-
|
153
|
-
|
144
|
+
root: ASSETS,
|
145
|
+
cascade: true,
|
146
|
+
header_rules: rules
|
154
147
|
m.each { |middleware, block| use(*middleware, &block) }
|
155
148
|
use Sidekiq::Web::CsrfProtection unless $TESTING
|
156
149
|
run WebApplication.new(klass)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sidekiq
|
4
|
+
# Sidekiq::Job is a new alias for Sidekiq::Worker as of Sidekiq 6.3.0.
|
5
|
+
# Use `include Sidekiq::Job` rather than `include Sidekiq::Worker`.
|
6
|
+
#
|
7
|
+
# The term "worker" is too generic and overly confusing, used in several
|
8
|
+
# different contexts meaning different things. Many people call a Sidekiq
|
9
|
+
# process a "worker". Some people call the thread that executes jobs a
|
10
|
+
# "worker". This change brings Sidekiq closer to ActiveJob where your job
|
11
|
+
# classes extend ApplicationJob.
|
12
|
+
Worker = Job
|
13
|
+
end
|