sidekiq 6.4.1 → 6.5.0
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 +43 -1
- data/README.md +1 -1
- data/bin/sidekiqload +16 -10
- data/lib/sidekiq/api.rb +42 -33
- data/lib/sidekiq/cli.rb +37 -36
- data/lib/sidekiq/client.rb +25 -26
- data/lib/sidekiq/component.rb +64 -0
- data/lib/sidekiq/extensions/generic_proxy.rb +1 -1
- data/lib/sidekiq/fetch.rb +15 -13
- data/lib/sidekiq/job_retry.rb +27 -26
- data/lib/sidekiq/job_util.rb +15 -9
- data/lib/sidekiq/launcher.rb +31 -29
- data/lib/sidekiq/logger.rb +5 -19
- data/lib/sidekiq/manager.rb +28 -25
- data/lib/sidekiq/middleware/chain.rb +22 -13
- data/lib/sidekiq/middleware/current_attributes.rb +4 -0
- data/lib/sidekiq/middleware/i18n.rb +6 -4
- data/lib/sidekiq/middleware/modules.rb +19 -0
- data/lib/sidekiq/monitor.rb +1 -1
- data/lib/sidekiq/paginator.rb +2 -2
- data/lib/sidekiq/processor.rb +38 -38
- data/lib/sidekiq/rails.rb +15 -8
- data/lib/sidekiq/redis_client_adapter.rb +154 -0
- data/lib/sidekiq/redis_connection.rb +81 -48
- data/lib/sidekiq/ring_buffer.rb +29 -0
- data/lib/sidekiq/scheduled.rb +11 -10
- data/lib/sidekiq/testing/inline.rb +4 -4
- data/lib/sidekiq/testing.rb +37 -36
- data/lib/sidekiq/transaction_aware_client.rb +45 -0
- data/lib/sidekiq/version.rb +1 -1
- data/lib/sidekiq/web/csrf_protection.rb +2 -2
- data/lib/sidekiq/web/helpers.rb +4 -4
- data/lib/sidekiq/worker.rb +18 -13
- data/lib/sidekiq.rb +97 -30
- data/web/assets/javascripts/application.js +58 -26
- data/web/assets/stylesheets/application.css +1 -2
- data/web/locales/pt-br.yml +27 -9
- data/web/views/_summary.erb +1 -1
- data/web/views/busy.erb +3 -3
- metadata +7 -4
- data/lib/sidekiq/exception_handler.rb +0 -27
- data/lib/sidekiq/util.rb +0 -108
@@ -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+.
|
@@ -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
@@ -140,8 +140,8 @@ module Sidekiq
|
|
140
140
|
params[:direction] == "asc" ? "↑" : "↓"
|
141
141
|
end
|
142
142
|
|
143
|
-
def
|
144
|
-
@
|
143
|
+
def workset
|
144
|
+
@work ||= Sidekiq::WorkSet.new
|
145
145
|
end
|
146
146
|
|
147
147
|
def processes
|
@@ -175,7 +175,7 @@ module Sidekiq
|
|
175
175
|
end
|
176
176
|
|
177
177
|
def current_status
|
178
|
-
|
178
|
+
workset.size == 0 ? "idle" : "active"
|
179
179
|
end
|
180
180
|
|
181
181
|
def relative_time(time)
|
@@ -301,7 +301,7 @@ module Sidekiq
|
|
301
301
|
end
|
302
302
|
|
303
303
|
def environment_title_prefix
|
304
|
-
environment = Sidekiq
|
304
|
+
environment = Sidekiq[:environment] || ENV["APP_ENV"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
|
305
305
|
|
306
306
|
"[#{environment.upcase}] " unless environment == "production"
|
307
307
|
end
|
data/lib/sidekiq/worker.rb
CHANGED
@@ -82,7 +82,7 @@ module Sidekiq
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def get_sidekiq_options # :nodoc:
|
85
|
-
self.sidekiq_options_hash ||= Sidekiq.
|
85
|
+
self.sidekiq_options_hash ||= Sidekiq.default_job_options
|
86
86
|
end
|
87
87
|
|
88
88
|
def sidekiq_class_attribute(*attrs)
|
@@ -175,16 +175,18 @@ module Sidekiq
|
|
175
175
|
|
176
176
|
def initialize(klass, opts)
|
177
177
|
@klass = klass
|
178
|
-
|
178
|
+
# NB: the internal hash always has stringified keys
|
179
|
+
@opts = opts.transform_keys(&:to_s)
|
179
180
|
|
180
181
|
# ActiveJob compatibility
|
181
|
-
interval = @opts.delete(
|
182
|
+
interval = @opts.delete("wait_until") || @opts.delete("wait")
|
182
183
|
at(interval) if interval
|
183
184
|
end
|
184
185
|
|
185
186
|
def set(options)
|
186
|
-
|
187
|
-
@opts.
|
187
|
+
hash = options.transform_keys(&:to_s)
|
188
|
+
interval = hash.delete("wait_until") || @opts.delete("wait")
|
189
|
+
@opts.merge!(hash)
|
188
190
|
at(interval) if interval
|
189
191
|
self
|
190
192
|
end
|
@@ -200,7 +202,7 @@ module Sidekiq
|
|
200
202
|
# Explicit inline execution of a job. Returns nil if the job did not
|
201
203
|
# execute, true otherwise.
|
202
204
|
def perform_inline(*args)
|
203
|
-
raw = @opts.merge("args" => args, "class" => @klass)
|
205
|
+
raw = @opts.merge("args" => args, "class" => @klass)
|
204
206
|
|
205
207
|
# validate and normalize payload
|
206
208
|
item = normalize_item(raw)
|
@@ -235,11 +237,9 @@ module Sidekiq
|
|
235
237
|
alias_method :perform_sync, :perform_inline
|
236
238
|
|
237
239
|
def perform_bulk(args, batch_size: 1_000)
|
238
|
-
|
239
|
-
pool = Thread.current[:sidekiq_via_pool] || @klass.get_sidekiq_options["pool"] || Sidekiq.redis_pool
|
240
|
-
client = Sidekiq::Client.new(pool)
|
240
|
+
client = @klass.build_client
|
241
241
|
result = args.each_slice(batch_size).flat_map do |slice|
|
242
|
-
client.push_bulk(
|
242
|
+
client.push_bulk(@opts.merge("class" => @klass, "args" => slice))
|
243
243
|
end
|
244
244
|
|
245
245
|
result.is_a?(Enumerator::Lazy) ? result.force : result
|
@@ -293,6 +293,7 @@ module Sidekiq
|
|
293
293
|
def perform_inline(*args)
|
294
294
|
Setter.new(self, {}).perform_inline(*args)
|
295
295
|
end
|
296
|
+
alias_method :perform_sync, :perform_inline
|
296
297
|
|
297
298
|
##
|
298
299
|
# Push a large number of jobs to Redis, while limiting the batch of
|
@@ -352,10 +353,14 @@ module Sidekiq
|
|
352
353
|
end
|
353
354
|
|
354
355
|
def client_push(item) # :nodoc:
|
355
|
-
|
356
|
-
|
356
|
+
raise ArgumentError, "Job payloads should contain no Symbols: #{item}" if item.any? { |k, v| k.is_a?(::Symbol) }
|
357
|
+
build_client.push(item)
|
358
|
+
end
|
357
359
|
|
358
|
-
|
360
|
+
def build_client # :nodoc:
|
361
|
+
pool = Thread.current[:sidekiq_via_pool] || get_sidekiq_options["pool"] || Sidekiq.redis_pool
|
362
|
+
client_class = get_sidekiq_options["client_class"] || Sidekiq::Client
|
363
|
+
client_class.new(pool)
|
359
364
|
end
|
360
365
|
end
|
361
366
|
end
|
data/lib/sidekiq.rb
CHANGED
@@ -5,6 +5,7 @@ fail "Sidekiq #{Sidekiq::VERSION} does not support Ruby versions below 2.5.0." i
|
|
5
5
|
|
6
6
|
require "sidekiq/logger"
|
7
7
|
require "sidekiq/client"
|
8
|
+
require "sidekiq/transaction_aware_client"
|
8
9
|
require "sidekiq/worker"
|
9
10
|
require "sidekiq/job"
|
10
11
|
require "sidekiq/redis_connection"
|
@@ -40,11 +41,6 @@ module Sidekiq
|
|
40
41
|
reloader: proc { |&block| block.call }
|
41
42
|
}
|
42
43
|
|
43
|
-
DEFAULT_WORKER_OPTIONS = {
|
44
|
-
"retry" => true,
|
45
|
-
"queue" => "default"
|
46
|
-
}
|
47
|
-
|
48
44
|
FAKE_INFO = {
|
49
45
|
"redis_version" => "9.9.9",
|
50
46
|
"uptime_in_days" => "9999",
|
@@ -57,19 +53,79 @@ module Sidekiq
|
|
57
53
|
puts "Calm down, yo."
|
58
54
|
end
|
59
55
|
|
56
|
+
# config.concurrency = 5
|
57
|
+
def self.concurrency=(val)
|
58
|
+
self[:concurrency] = Integer(val)
|
59
|
+
end
|
60
|
+
|
61
|
+
# config.queues = %w( high default low ) # strict
|
62
|
+
# config.queues = %w( high,3 default,2 low,1 ) # weighted
|
63
|
+
# config.queues = %w( feature1,1 feature2,1 feature3,1 ) # random
|
64
|
+
#
|
65
|
+
# With weighted priority, queue will be checked first (weight / total) of the time.
|
66
|
+
# high will be checked first (3/6) or 50% of the time.
|
67
|
+
# I'd recommend setting weights between 1-10. Weights in the hundreds or thousands
|
68
|
+
# are ridiculous and unnecessarily expensive. You can get random queue ordering
|
69
|
+
# by explicitly setting all weights to 1.
|
70
|
+
def self.queues=(val)
|
71
|
+
self[:queues] = Array(val).each_with_object([]) do |qstr, memo|
|
72
|
+
name, weight = qstr.split(",")
|
73
|
+
self[:strict] = false if weight.to_i > 0
|
74
|
+
[weight.to_i, 1].max.times do
|
75
|
+
memo << name
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
### Private APIs
|
81
|
+
def self.default_error_handler(ex, ctx)
|
82
|
+
logger.warn(dump_json(ctx)) unless ctx.empty?
|
83
|
+
logger.warn("#{ex.class.name}: #{ex.message}")
|
84
|
+
logger.warn(ex.backtrace.join("\n")) unless ex.backtrace.nil?
|
85
|
+
end
|
86
|
+
|
87
|
+
@config = DEFAULTS.dup
|
60
88
|
def self.options
|
61
|
-
|
89
|
+
logger.warn "`config.options[:key] = value` is deprecated, use `config[:key] = value`: #{caller(1..2)}"
|
90
|
+
@config
|
62
91
|
end
|
63
92
|
|
64
93
|
def self.options=(opts)
|
65
|
-
|
94
|
+
logger.warn "config.options = hash` is deprecated, use `config.merge!(hash)`: #{caller(1..2)}"
|
95
|
+
@config = opts
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.[](key)
|
99
|
+
@config[key]
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.[]=(key, val)
|
103
|
+
@config[key] = val
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.merge!(hash)
|
107
|
+
@config.merge!(hash)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.fetch(*args, &block)
|
111
|
+
@config.fetch(*args, &block)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.handle_exception(ex, ctx = {})
|
115
|
+
self[:error_handlers].each do |handler|
|
116
|
+
handler.call(ex, ctx)
|
117
|
+
rescue => ex
|
118
|
+
logger.error "!!! ERROR HANDLER THREW AN ERROR !!!"
|
119
|
+
logger.error ex
|
120
|
+
logger.error ex.backtrace.join("\n") unless ex.backtrace.nil?
|
121
|
+
end
|
66
122
|
end
|
123
|
+
###
|
67
124
|
|
68
125
|
##
|
69
126
|
# Configuration for Sidekiq server, use like:
|
70
127
|
#
|
71
128
|
# Sidekiq.configure_server do |config|
|
72
|
-
# config.redis = { :namespace => 'myapp', :size => 25, :url => 'redis://myhost:8877/0' }
|
73
129
|
# config.server_middleware do |chain|
|
74
130
|
# chain.add MyServerHook
|
75
131
|
# end
|
@@ -82,7 +138,7 @@ module Sidekiq
|
|
82
138
|
# Configuration for Sidekiq client, use like:
|
83
139
|
#
|
84
140
|
# Sidekiq.configure_client do |config|
|
85
|
-
# config.redis = { :
|
141
|
+
# config.redis = { size: 1, url: 'redis://myhost:8877/0' }
|
86
142
|
# end
|
87
143
|
def self.configure_client
|
88
144
|
yield self unless server?
|
@@ -98,7 +154,7 @@ module Sidekiq
|
|
98
154
|
retryable = true
|
99
155
|
begin
|
100
156
|
yield conn
|
101
|
-
rescue
|
157
|
+
rescue RedisConnection.adapter::BaseError => ex
|
102
158
|
# 2550 Failover can cause the server to become a replica, need
|
103
159
|
# to disconnect and reopen the socket to get back to the primary.
|
104
160
|
# 4495 Use the same logic if we have a "Not enough replicas" error from the primary
|
@@ -123,7 +179,7 @@ module Sidekiq
|
|
123
179
|
else
|
124
180
|
conn.info
|
125
181
|
end
|
126
|
-
rescue
|
182
|
+
rescue RedisConnection.adapter::CommandError => ex
|
127
183
|
# 2850 return fake version when INFO command has (probably) been renamed
|
128
184
|
raise unless /unknown command/.match?(ex.message)
|
129
185
|
FAKE_INFO
|
@@ -131,19 +187,19 @@ module Sidekiq
|
|
131
187
|
end
|
132
188
|
|
133
189
|
def self.redis_pool
|
134
|
-
@redis ||=
|
190
|
+
@redis ||= RedisConnection.create
|
135
191
|
end
|
136
192
|
|
137
193
|
def self.redis=(hash)
|
138
194
|
@redis = if hash.is_a?(ConnectionPool)
|
139
195
|
hash
|
140
196
|
else
|
141
|
-
|
197
|
+
RedisConnection.create(hash)
|
142
198
|
end
|
143
199
|
end
|
144
200
|
|
145
201
|
def self.client_middleware
|
146
|
-
@client_chain ||= Middleware::Chain.new
|
202
|
+
@client_chain ||= Middleware::Chain.new(self)
|
147
203
|
yield @client_chain if block_given?
|
148
204
|
@client_chain
|
149
205
|
end
|
@@ -155,16 +211,23 @@ module Sidekiq
|
|
155
211
|
end
|
156
212
|
|
157
213
|
def self.default_server_middleware
|
158
|
-
Middleware::Chain.new
|
214
|
+
Middleware::Chain.new(self)
|
215
|
+
end
|
216
|
+
|
217
|
+
def self.default_worker_options=(hash) # deprecated
|
218
|
+
@default_job_options = default_job_options.merge(hash.transform_keys(&:to_s))
|
159
219
|
end
|
160
220
|
|
161
|
-
def self.
|
162
|
-
|
163
|
-
@default_worker_options = default_worker_options.merge(hash.transform_keys(&:to_s))
|
221
|
+
def self.default_job_options=(hash)
|
222
|
+
@default_job_options = default_job_options.merge(hash.transform_keys(&:to_s))
|
164
223
|
end
|
165
224
|
|
166
|
-
def self.default_worker_options
|
167
|
-
|
225
|
+
def self.default_worker_options # deprecated
|
226
|
+
@default_job_options ||= {"retry" => true, "queue" => "default"}
|
227
|
+
end
|
228
|
+
|
229
|
+
def self.default_job_options
|
230
|
+
@default_job_options ||= {"retry" => true, "queue" => "default"}
|
168
231
|
end
|
169
232
|
|
170
233
|
##
|
@@ -177,7 +240,7 @@ module Sidekiq
|
|
177
240
|
# end
|
178
241
|
# end
|
179
242
|
def self.death_handlers
|
180
|
-
|
243
|
+
self[:death_handlers]
|
181
244
|
end
|
182
245
|
|
183
246
|
def self.load_json(string)
|
@@ -202,7 +265,7 @@ module Sidekiq
|
|
202
265
|
end
|
203
266
|
|
204
267
|
def self.logger
|
205
|
-
@logger ||= Sidekiq::Logger.new($stdout, level:
|
268
|
+
@logger ||= Sidekiq::Logger.new($stdout, level: :info)
|
206
269
|
end
|
207
270
|
|
208
271
|
def self.logger=(logger)
|
@@ -220,13 +283,17 @@ module Sidekiq
|
|
220
283
|
defined?(Sidekiq::Pro)
|
221
284
|
end
|
222
285
|
|
286
|
+
def self.ent?
|
287
|
+
defined?(Sidekiq::Enterprise)
|
288
|
+
end
|
289
|
+
|
223
290
|
# How frequently Redis should be checked by a random Sidekiq process for
|
224
291
|
# scheduled and retriable jobs. Each individual process will take turns by
|
225
292
|
# waiting some multiple of this value.
|
226
293
|
#
|
227
294
|
# See sidekiq/scheduled.rb for an in-depth explanation of this value
|
228
295
|
def self.average_scheduled_poll_interval=(interval)
|
229
|
-
|
296
|
+
self[:average_scheduled_poll_interval] = interval
|
230
297
|
end
|
231
298
|
|
232
299
|
# Register a proc to handle any error which occurs within the Sidekiq process.
|
@@ -237,7 +304,7 @@ module Sidekiq
|
|
237
304
|
#
|
238
305
|
# The default error handler logs errors to Sidekiq.logger.
|
239
306
|
def self.error_handlers
|
240
|
-
|
307
|
+
self[:error_handlers]
|
241
308
|
end
|
242
309
|
|
243
310
|
# Register a block to run at a point in the Sidekiq lifecycle.
|
@@ -250,20 +317,20 @@ module Sidekiq
|
|
250
317
|
# end
|
251
318
|
def self.on(event, &block)
|
252
319
|
raise ArgumentError, "Symbols only please: #{event}" unless event.is_a?(Symbol)
|
253
|
-
raise ArgumentError, "Invalid event name: #{event}" unless
|
254
|
-
|
320
|
+
raise ArgumentError, "Invalid event name: #{event}" unless self[:lifecycle_events].key?(event)
|
321
|
+
self[:lifecycle_events][event] << block
|
255
322
|
end
|
256
323
|
|
257
324
|
def self.strict_args!(mode = :raise)
|
258
|
-
|
325
|
+
self[:on_complex_arguments] = mode
|
259
326
|
end
|
260
327
|
|
261
|
-
# We are shutting down Sidekiq but what about
|
328
|
+
# We are shutting down Sidekiq but what about threads that
|
262
329
|
# are working on some long job? This error is
|
263
|
-
# raised in
|
330
|
+
# raised in jobs that have not finished within the hard
|
264
331
|
# timeout limit. This is needed to rollback db transactions,
|
265
332
|
# otherwise Ruby's Thread#kill will commit. See #377.
|
266
|
-
# DO NOT RESCUE THIS ERROR IN YOUR
|
333
|
+
# DO NOT RESCUE THIS ERROR IN YOUR JOBS
|
267
334
|
class Shutdown < Interrupt; end
|
268
335
|
end
|
269
336
|
|
@@ -9,7 +9,9 @@ var ready = (callback) => {
|
|
9
9
|
else document.addEventListener("DOMContentLoaded", callback);
|
10
10
|
}
|
11
11
|
|
12
|
-
ready(
|
12
|
+
ready(addListeners)
|
13
|
+
|
14
|
+
function addListeners() {
|
13
15
|
document.querySelectorAll(".check_all").forEach(node => {
|
14
16
|
node.addEventListener("click", event => {
|
15
17
|
node.closest('table').querySelectorAll('input[type=checkbox]').forEach(inp => { inp.checked = !!node.checked; });
|
@@ -26,42 +28,48 @@ ready(() => {
|
|
26
28
|
})
|
27
29
|
|
28
30
|
document.querySelectorAll("[data-toggle]").forEach(node => {
|
29
|
-
node.addEventListener("click",
|
30
|
-
var targName = node.getAttribute("data-toggle");
|
31
|
-
var full = document.getElementById(targName + "_full");
|
32
|
-
if (full.style.display == "block") {
|
33
|
-
full.style.display = 'none';
|
34
|
-
} else {
|
35
|
-
full.style.display = 'block';
|
36
|
-
}
|
37
|
-
})
|
31
|
+
node.addEventListener("click", addDataToggleListeners)
|
38
32
|
})
|
39
33
|
|
40
34
|
updateFuzzyTimes();
|
35
|
+
setLivePollFromUrl();
|
41
36
|
|
42
37
|
var buttons = document.querySelectorAll(".live-poll");
|
43
38
|
if (buttons.length > 0) {
|
44
39
|
buttons.forEach(node => {
|
45
|
-
node.addEventListener("click",
|
46
|
-
if (localStorage.sidekiqLivePoll == "enabled") {
|
47
|
-
localStorage.sidekiqLivePoll = "disabled";
|
48
|
-
clearTimeout(livePollTimer);
|
49
|
-
livePollTimer = null;
|
50
|
-
} else {
|
51
|
-
localStorage.sidekiqLivePoll = "enabled";
|
52
|
-
livePollCallback();
|
53
|
-
}
|
54
|
-
|
55
|
-
updateLivePollButton();
|
56
|
-
})
|
40
|
+
node.addEventListener("click", addPollingListeners)
|
57
41
|
});
|
58
42
|
|
59
43
|
updateLivePollButton();
|
60
|
-
if (localStorage.sidekiqLivePoll == "enabled") {
|
44
|
+
if (localStorage.sidekiqLivePoll == "enabled" && !livePollTimer) {
|
61
45
|
scheduleLivePoll();
|
62
46
|
}
|
63
47
|
}
|
64
|
-
}
|
48
|
+
}
|
49
|
+
|
50
|
+
function addPollingListeners(_event) {
|
51
|
+
if (localStorage.sidekiqLivePoll == "enabled") {
|
52
|
+
localStorage.sidekiqLivePoll = "disabled";
|
53
|
+
clearTimeout(livePollTimer);
|
54
|
+
livePollTimer = null;
|
55
|
+
} else {
|
56
|
+
localStorage.sidekiqLivePoll = "enabled";
|
57
|
+
livePollCallback();
|
58
|
+
}
|
59
|
+
|
60
|
+
updateLivePollButton();
|
61
|
+
}
|
62
|
+
|
63
|
+
function addDataToggleListeners(event) {
|
64
|
+
var source = event.target || event.srcElement;
|
65
|
+
var targName = source.getAttribute("data-toggle");
|
66
|
+
var full = document.getElementById(targName + "_full");
|
67
|
+
if (full.style.display == "block") {
|
68
|
+
full.style.display = 'none';
|
69
|
+
} else {
|
70
|
+
full.style.display = 'block';
|
71
|
+
}
|
72
|
+
}
|
65
73
|
|
66
74
|
function updateFuzzyTimes() {
|
67
75
|
var locale = document.body.getAttribute("data-locale");
|
@@ -76,6 +84,14 @@ function updateFuzzyTimes() {
|
|
76
84
|
t.cancel();
|
77
85
|
}
|
78
86
|
|
87
|
+
function setLivePollFromUrl() {
|
88
|
+
var url_params = new URL(window.location.href).searchParams
|
89
|
+
|
90
|
+
if (url_params.get("poll") == "true") {
|
91
|
+
localStorage.sidekiqLivePoll = "enabled";
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
79
95
|
function updateLivePollButton() {
|
80
96
|
if (localStorage.sidekiqLivePoll == "enabled") {
|
81
97
|
document.querySelectorAll('.live-poll-stop').forEach(box => { box.style.display = "inline-block" })
|
@@ -89,7 +105,19 @@ function updateLivePollButton() {
|
|
89
105
|
function livePollCallback() {
|
90
106
|
clearTimeout(livePollTimer);
|
91
107
|
|
92
|
-
fetch(window.location.href)
|
108
|
+
fetch(window.location.href)
|
109
|
+
.then(checkResponse)
|
110
|
+
.then(resp => resp.text())
|
111
|
+
.then(replacePage)
|
112
|
+
.catch(showError)
|
113
|
+
.finally(scheduleLivePoll)
|
114
|
+
}
|
115
|
+
|
116
|
+
function checkResponse(resp) {
|
117
|
+
if (!resp.ok) {
|
118
|
+
throw response.error();
|
119
|
+
}
|
120
|
+
return resp
|
93
121
|
}
|
94
122
|
|
95
123
|
function scheduleLivePoll() {
|
@@ -107,5 +135,9 @@ function replacePage(text) {
|
|
107
135
|
var header_status = doc.querySelector('.status')
|
108
136
|
document.querySelector('.status').replaceWith(header_status)
|
109
137
|
|
110
|
-
|
138
|
+
addListeners();
|
139
|
+
}
|
140
|
+
|
141
|
+
function showError(error) {
|
142
|
+
console.error(error)
|
111
143
|
}
|
data/web/locales/pt-br.yml
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
History: Histórico
|
9
9
|
Busy: Ocupados
|
10
10
|
Processed: Processados
|
11
|
+
Utilization: Utilização
|
11
12
|
Failed: Falhas
|
12
13
|
Scheduled: Agendados
|
13
14
|
Retries: Tentativas
|
@@ -26,18 +27,20 @@
|
|
26
27
|
Delete: Apagar
|
27
28
|
AddToQueue: Adicionar à fila
|
28
29
|
AreYouSureDeleteJob: Deseja deletar esta tarefa?
|
29
|
-
AreYouSureDeleteQueue: Deseja deletar a %{queue} fila
|
30
|
+
AreYouSureDeleteQueue: Deseja deletar a fila %{queue}? Isso irá deletar todas as tarefas desta fila.
|
30
31
|
Queues: Filas
|
31
32
|
Size: Tamanho
|
32
33
|
Actions: Ações
|
33
34
|
NextRetry: Próxima Tentativa
|
34
35
|
RetryCount: Número de Tentativas
|
35
36
|
RetryNow: Tentar novamente agora
|
37
|
+
Kill: Matar
|
36
38
|
LastRetry: Última tentativa
|
37
39
|
OriginallyFailed: Falhou originalmente
|
38
40
|
AreYouSure: Tem certeza?
|
39
41
|
DeleteAll: Apagar tudo
|
40
42
|
RetryAll: Tentar tudo novamente
|
43
|
+
KillAll: Matar todas
|
41
44
|
NoRetriesFound: Nenhuma tentativa encontrada
|
42
45
|
Error: Erro
|
43
46
|
ErrorClass: Classe de erro
|
@@ -58,11 +61,26 @@
|
|
58
61
|
OneMonth: 1 mês
|
59
62
|
ThreeMonths: 3 meses
|
60
63
|
SixMonths: 6 meses
|
61
|
-
Failures
|
62
|
-
DeadJobs
|
63
|
-
NoDeadJobsFound
|
64
|
-
Dead
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
Failures: Falhas
|
65
|
+
DeadJobs: Tarefas mortas
|
66
|
+
NoDeadJobsFound: Nenhuma tarefa morta foi encontrada
|
67
|
+
Dead: Morta
|
68
|
+
Process: Processo
|
69
|
+
Processes: Processos
|
70
|
+
Name: Nome
|
71
|
+
Thread: Thread
|
72
|
+
Threads: Threads
|
73
|
+
Jobs: Tarefas
|
74
|
+
Paused: Pausado
|
75
|
+
Stop: Parar
|
76
|
+
Quiet: Silenciar
|
77
|
+
StopAll: Parar Todos
|
78
|
+
QuietAll: Silenciar Todos
|
79
|
+
PollingInterval: Intervalo de Polling
|
80
|
+
Plugins: Plug-ins
|
81
|
+
NotYetEnqueued: Ainda não enfileirado
|
82
|
+
CreatedAt: Criado em
|
83
|
+
BackToApp: De volta ao aplicativo
|
84
|
+
Latency: Latência
|
85
|
+
Pause: Pausar
|
86
|
+
Unpause: Despausar
|
data/web/views/_summary.erb
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
</li>
|
10
10
|
<li class="busy col-sm-1">
|
11
11
|
<a href="<%= root_path %>busy">
|
12
|
-
<span id="txtBusy" class="count"><%= number_with_delimiter(
|
12
|
+
<span id="txtBusy" class="count"><%= number_with_delimiter(workset.size) %></span>
|
13
13
|
<span class="desc"><%= t('Busy') %></span>
|
14
14
|
</a>
|
15
15
|
</li>
|
data/web/views/busy.erb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
<p><%= t('Threads') %></p>
|
16
16
|
</div>
|
17
17
|
<div class="stat">
|
18
|
-
<h3><%= ws =
|
18
|
+
<h3><%= ws = workset.size; number_with_delimiter(ws) %></h3>
|
19
19
|
<p><%= t('Busy') %></p>
|
20
20
|
</div>
|
21
21
|
<div class="stat">
|
@@ -48,7 +48,7 @@
|
|
48
48
|
<thead>
|
49
49
|
<th><%= t('Name') %></th>
|
50
50
|
<th><%= t('Started') %></th>
|
51
|
-
<th class="col-sm-1"><%= t('RSS') %><a href="https://github.com/mperham/sidekiq/wiki/Memory#rss"><span class="info-circle" title="Click to learn more about RSS">?</span></a></th>
|
51
|
+
<th class="col-sm-1"><%= t('RSS') %><a target="blank" href="https://github.com/mperham/sidekiq/wiki/Memory#rss"><span class="info-circle" title="Click to learn more about RSS">?</span></a></th>
|
52
52
|
<th class="col-sm-1"><%= t('Threads') %></th>
|
53
53
|
<th class="col-sm-1"><%= t('Busy') %></th>
|
54
54
|
<th> </th>
|
@@ -109,7 +109,7 @@
|
|
109
109
|
<th><%= t('Arguments') %></th>
|
110
110
|
<th><%= t('Started') %></th>
|
111
111
|
</thead>
|
112
|
-
<%
|
112
|
+
<% workset.each do |process, thread, msg| %>
|
113
113
|
<% job = Sidekiq::JobRecord.new(msg['payload']) %>
|
114
114
|
<tr>
|
115
115
|
<td><%= process %></td>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Perham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -75,8 +75,8 @@ files:
|
|
75
75
|
- lib/sidekiq/api.rb
|
76
76
|
- lib/sidekiq/cli.rb
|
77
77
|
- lib/sidekiq/client.rb
|
78
|
+
- lib/sidekiq/component.rb
|
78
79
|
- lib/sidekiq/delay.rb
|
79
|
-
- lib/sidekiq/exception_handler.rb
|
80
80
|
- lib/sidekiq/extensions/action_mailer.rb
|
81
81
|
- lib/sidekiq/extensions/active_record.rb
|
82
82
|
- lib/sidekiq/extensions/class_methods.rb
|
@@ -92,17 +92,20 @@ files:
|
|
92
92
|
- lib/sidekiq/middleware/chain.rb
|
93
93
|
- lib/sidekiq/middleware/current_attributes.rb
|
94
94
|
- lib/sidekiq/middleware/i18n.rb
|
95
|
+
- lib/sidekiq/middleware/modules.rb
|
95
96
|
- lib/sidekiq/monitor.rb
|
96
97
|
- lib/sidekiq/paginator.rb
|
97
98
|
- lib/sidekiq/processor.rb
|
98
99
|
- lib/sidekiq/rails.rb
|
100
|
+
- lib/sidekiq/redis_client_adapter.rb
|
99
101
|
- lib/sidekiq/redis_connection.rb
|
102
|
+
- lib/sidekiq/ring_buffer.rb
|
100
103
|
- lib/sidekiq/scheduled.rb
|
101
104
|
- lib/sidekiq/sd_notify.rb
|
102
105
|
- lib/sidekiq/systemd.rb
|
103
106
|
- lib/sidekiq/testing.rb
|
104
107
|
- lib/sidekiq/testing/inline.rb
|
105
|
-
- lib/sidekiq/
|
108
|
+
- lib/sidekiq/transaction_aware_client.rb
|
106
109
|
- lib/sidekiq/version.rb
|
107
110
|
- lib/sidekiq/web.rb
|
108
111
|
- lib/sidekiq/web/action.rb
|