sidekiq 6.4.0 → 6.5.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 +54 -1
- data/README.md +6 -1
- data/bin/sidekiq +3 -3
- data/bin/sidekiqload +70 -66
- data/bin/sidekiqmon +1 -1
- data/lib/sidekiq/.DS_Store +0 -0
- data/lib/sidekiq/api.rb +109 -78
- data/lib/sidekiq/cli.rb +47 -38
- data/lib/sidekiq/client.rb +42 -28
- data/lib/sidekiq/component.rb +64 -0
- data/lib/sidekiq/delay.rb +2 -2
- data/lib/sidekiq/extensions/action_mailer.rb +2 -2
- data/lib/sidekiq/extensions/active_record.rb +2 -2
- data/lib/sidekiq/extensions/class_methods.rb +2 -2
- data/lib/sidekiq/extensions/generic_proxy.rb +3 -3
- data/lib/sidekiq/fetch.rb +18 -16
- data/lib/sidekiq/job_logger.rb +15 -27
- data/lib/sidekiq/job_retry.rb +29 -28
- data/lib/sidekiq/job_util.rb +15 -9
- data/lib/sidekiq/launcher.rb +54 -52
- data/lib/sidekiq/logger.rb +8 -18
- 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 +21 -0
- data/lib/sidekiq/monitor.rb +1 -1
- data/lib/sidekiq/paginator.rb +8 -8
- 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 +5 -5
- data/lib/sidekiq/web.rb +3 -3
- data/lib/sidekiq/worker.rb +20 -17
- data/lib/sidekiq.rb +98 -30
- data/web/assets/javascripts/application.js +58 -26
- data/web/assets/stylesheets/application.css +1 -0
- data/web/locales/pt-br.yml +27 -9
- data/web/views/_summary.erb +1 -1
- data/web/views/busy.erb +3 -3
- metadata +9 -5
- data/lib/sidekiq/exception_handler.rb +0 -27
- data/lib/sidekiq/util.rb +0 -108
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1afbc6a1a0b14403e9148e746c08e0a2b24e634fca05288982c96719675607de
|
4
|
+
data.tar.gz: 3ff3f8df76b565f42030462eb8d09b673b89751dcd6a0b7c41a255789960d321
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8a68611735322d98cc517f1d03ef02394497f8eb505e0db496909cac1f6b7f0179f38ce1966546f717115395102c78fdad9ae0fd947360307b9288dcc22b369
|
7
|
+
data.tar.gz: 163e41dfb153a4e2ec50d407bde08cb8a395909807053f24478a73af1a6a9858b5aec92cbf618d4d066560a2b7bedaa2f88b48f823609e2d78f21320270cb97e
|
data/Changes.md
CHANGED
@@ -2,6 +2,53 @@
|
|
2
2
|
|
3
3
|
[Sidekiq Changes](https://github.com/mperham/sidekiq/blob/main/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/main/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/main/Ent-Changes.md)
|
4
4
|
|
5
|
+
6.5.1
|
6
|
+
----------
|
7
|
+
|
8
|
+
- Fix `push_bulk` breakage [#5387]
|
9
|
+
|
10
|
+
6.5.0
|
11
|
+
---------
|
12
|
+
|
13
|
+
- Substantial refactoring of Sidekiq server internals, part of a larger effort
|
14
|
+
to reduce Sidekiq's internal usage of global methods and data, see [docs/global_to_local.md](docs/global_to_local.md) and [docs/middleware.md](docs/middleware.md).
|
15
|
+
- **Add beta support for the `redis-client` gem**. This will become the default Redis driver in Sidekiq 7.0. [#5298]
|
16
|
+
Read more: https://github.com/mperham/sidekiq/wiki/Using-redis-client
|
17
|
+
- **Add beta support for DB transaction-aware client** [#5291]
|
18
|
+
Add this line to your initializer and any jobs created during a transaction
|
19
|
+
will only be pushed to Redis **after the transaction commits**. You will need to add the
|
20
|
+
`after_commit_everywhere` gem to your Gemfile.
|
21
|
+
```ruby
|
22
|
+
Sidekiq.transactional_push!
|
23
|
+
```
|
24
|
+
This feature does not have a lot of production usage yet; please try it out and let us
|
25
|
+
know if you have any issues. It will be fully supported in Sidekiq 7.0 or removed if it
|
26
|
+
proves problematic.
|
27
|
+
- Fix regression with middleware arguments [#5312]
|
28
|
+
|
29
|
+
6.4.2
|
30
|
+
---------
|
31
|
+
|
32
|
+
- Strict argument checking now runs after client-side middleware [#5246]
|
33
|
+
- Fix page events with live polling [#5184]
|
34
|
+
- Many under-the-hood changes to remove all usage of the term "worker"
|
35
|
+
from the Sidekiq codebase and APIs. This mostly involved RDoc and local
|
36
|
+
variable names but a few constants and public APIs were changed. The old
|
37
|
+
APIs will be removed in Sidekiq 7.0.
|
38
|
+
```
|
39
|
+
Sidekiq::DEFAULT_WORKER_OPTIONS -> Sidekiq.default_job_options
|
40
|
+
Sidekiq.default_worker_options -> Sidekiq.default_job_options
|
41
|
+
Sidekiq::Queues["default"].jobs_by_worker(HardJob) -> Sidekiq::Queues["default"].jobs_by_class(HardJob)
|
42
|
+
```
|
43
|
+
|
44
|
+
6.4.1
|
45
|
+
---------
|
46
|
+
|
47
|
+
- Fix pipeline/multi deprecations in redis-rb 4.6
|
48
|
+
- Fix sidekiq.yml YAML load errors on Ruby 3.1 [#5141]
|
49
|
+
- Sharding support for `perform_bulk` [#5129]
|
50
|
+
- Refactor job logger for SPEEEEEEED
|
51
|
+
|
5
52
|
6.4.0
|
6
53
|
---------
|
7
54
|
|
@@ -27,7 +74,6 @@ bin/rails generate sidekiq:job ProcessOrderJob
|
|
27
74
|
```
|
28
75
|
- Fix job retries losing CurrentAttributes [#5090]
|
29
76
|
- Tweak shutdown to give long-running threads time to cleanup [#5095]
|
30
|
-
- Add keyword arguments support in extensions
|
31
77
|
|
32
78
|
6.3.1
|
33
79
|
---------
|
@@ -312,6 +358,13 @@ See the [Logging wiki page](https://github.com/mperham/sidekiq/wiki/Logging) for
|
|
312
358
|
- Integrate the StandardRB code formatter to ensure consistent code
|
313
359
|
styling. [#4114, gearnode]
|
314
360
|
|
361
|
+
5.2.10
|
362
|
+
---------
|
363
|
+
|
364
|
+
- Backport fix for CVE-2022-23837.
|
365
|
+
- Migrate to `exists?` for redis-rb.
|
366
|
+
- Lock redis-rb to <4.6 to avoid deprecations.
|
367
|
+
|
315
368
|
5.2.9
|
316
369
|
---------
|
317
370
|
|
data/README.md
CHANGED
@@ -36,7 +36,7 @@ Sidekiq 6.0 supports Rails 5.0+ but does not require it.
|
|
36
36
|
Installation
|
37
37
|
-----------------
|
38
38
|
|
39
|
-
|
39
|
+
bundle add sidekiq
|
40
40
|
|
41
41
|
|
42
42
|
Getting Started
|
@@ -80,6 +80,11 @@ Useful resources:
|
|
80
80
|
Every Friday morning is Sidekiq happy hour: I video chat and answer questions.
|
81
81
|
See the [Sidekiq support page](https://sidekiq.org/support.html) for details.
|
82
82
|
|
83
|
+
Contributing
|
84
|
+
-----------------
|
85
|
+
|
86
|
+
Please see [the contributing guidelines](https://github.com/mperham/sidekiq/blob/main/.github/contributing.md).
|
87
|
+
|
83
88
|
|
84
89
|
License
|
85
90
|
-----------------
|
data/bin/sidekiq
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# RUBYOPT=-w bundle exec sidekiq
|
5
5
|
$TESTING = false
|
6
6
|
|
7
|
-
require_relative
|
7
|
+
require_relative "../lib/sidekiq/cli"
|
8
8
|
|
9
9
|
def integrate_with_systemd
|
10
10
|
return unless ENV["NOTIFY_SOCKET"]
|
@@ -32,8 +32,8 @@ begin
|
|
32
32
|
rescue => e
|
33
33
|
raise e if $DEBUG
|
34
34
|
if Sidekiq.error_handlers.length == 0
|
35
|
-
|
36
|
-
|
35
|
+
warn e.message
|
36
|
+
warn e.backtrace.join("\n")
|
37
37
|
else
|
38
38
|
cli.handle_exception e
|
39
39
|
end
|
data/bin/sidekiqload
CHANGED
@@ -4,19 +4,22 @@
|
|
4
4
|
# RUBYOPT=-w bundle exec sidekiq
|
5
5
|
$TESTING = false
|
6
6
|
|
7
|
-
#require
|
8
|
-
require
|
7
|
+
# require "ruby-prof"
|
8
|
+
require "bundler/setup"
|
9
9
|
Bundler.require(:default, :load_test)
|
10
10
|
|
11
|
-
require_relative
|
12
|
-
require_relative
|
11
|
+
require_relative "../lib/sidekiq/cli"
|
12
|
+
require_relative "../lib/sidekiq/launcher"
|
13
13
|
|
14
|
-
|
14
|
+
if ENV["SIDEKIQ_REDIS_CLIENT"]
|
15
|
+
Sidekiq::RedisConnection.adapter = :redis_client
|
16
|
+
end
|
15
17
|
|
16
18
|
Sidekiq.configure_server do |config|
|
17
19
|
config.options[:concurrency] = 10
|
18
|
-
config.redis = {
|
19
|
-
config.
|
20
|
+
config.redis = {db: 13, port: 6380}
|
21
|
+
# config.redis = { db: 13, port: 6380, driver: :hiredis}
|
22
|
+
config.options[:queues] << "default"
|
20
23
|
config.logger.level = Logger::ERROR
|
21
24
|
config.average_scheduled_poll_interval = 2
|
22
25
|
config.reliable! if defined?(Sidekiq::Pro)
|
@@ -29,53 +32,50 @@ class LoadWorker
|
|
29
32
|
1
|
30
33
|
end
|
31
34
|
|
32
|
-
def perform(idx, ts=nil)
|
33
|
-
puts(Time.now.to_f - ts) if ts
|
34
|
-
#raise idx.to_s if idx % 100 == 1
|
35
|
+
def perform(idx, ts = nil)
|
36
|
+
puts(Time.now.to_f - ts) if !ts.nil?
|
37
|
+
# raise idx.to_s if idx % 100 == 1
|
35
38
|
end
|
36
39
|
end
|
37
40
|
|
38
41
|
# brew tap shopify/shopify
|
39
42
|
# brew install toxiproxy
|
40
|
-
# gem install toxiproxy
|
41
43
|
# run `toxiproxy-server` in a separate terminal window.
|
42
|
-
require
|
44
|
+
require "toxiproxy"
|
43
45
|
# simulate a non-localhost network for realer-world conditions.
|
44
46
|
# adding 1ms of network latency has an ENORMOUS impact on benchmarks
|
45
47
|
Toxiproxy.populate([{
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
name: "redis",
|
49
|
+
listen: "127.0.0.1:6380",
|
50
|
+
upstream: "127.0.0.1:6379"
|
49
51
|
}])
|
50
52
|
|
51
53
|
self_read, self_write = IO.pipe
|
52
|
-
%w
|
53
|
-
|
54
|
-
|
55
|
-
self_write.puts(sig)
|
56
|
-
end
|
57
|
-
rescue ArgumentError
|
58
|
-
puts "Signal #{sig} not supported"
|
54
|
+
%w[INT TERM TSTP TTIN].each do |sig|
|
55
|
+
trap sig do
|
56
|
+
self_write.puts(sig)
|
59
57
|
end
|
58
|
+
rescue ArgumentError
|
59
|
+
puts "Signal #{sig} not supported"
|
60
60
|
end
|
61
61
|
|
62
|
-
Sidekiq.redis {|c| c.flushdb}
|
62
|
+
Sidekiq.redis { |c| c.flushdb }
|
63
63
|
def handle_signal(launcher, sig)
|
64
64
|
Sidekiq.logger.debug "Got #{sig} signal"
|
65
65
|
case sig
|
66
|
-
when
|
66
|
+
when "INT"
|
67
67
|
# Handle Ctrl-C in JRuby like MRI
|
68
68
|
# http://jira.codehaus.org/browse/JRUBY-4637
|
69
69
|
raise Interrupt
|
70
|
-
when
|
70
|
+
when "TERM"
|
71
71
|
# Heroku sends TERM and then waits 30 seconds for process to exit.
|
72
72
|
raise Interrupt
|
73
|
-
when
|
73
|
+
when "TSTP"
|
74
74
|
Sidekiq.logger.info "Received TSTP, no longer accepting new work"
|
75
75
|
launcher.quiet
|
76
|
-
when
|
76
|
+
when "TTIN"
|
77
77
|
Thread.list.each do |thread|
|
78
|
-
Sidekiq.logger.warn "Thread TID-#{(thread.object_id ^ ::Process.pid).to_s(36)} #{thread[
|
78
|
+
Sidekiq.logger.warn "Thread TID-#{(thread.object_id ^ ::Process.pid).to_s(36)} #{thread["label"]}"
|
79
79
|
if thread.backtrace
|
80
80
|
Sidekiq.logger.warn thread.backtrace.join("\n")
|
81
81
|
else
|
@@ -89,52 +89,56 @@ def Process.rss
|
|
89
89
|
`ps -o rss= -p #{Process.pid}`.chomp.to_i
|
90
90
|
end
|
91
91
|
|
92
|
-
iter =
|
92
|
+
iter = 50
|
93
93
|
count = 10_000
|
94
94
|
|
95
95
|
iter.times do
|
96
|
-
arr = Array.new(count)
|
97
|
-
|
98
|
-
end
|
99
|
-
count.times do |idx|
|
100
|
-
arr[idx][0] = idx
|
101
|
-
end
|
102
|
-
Sidekiq::Client.push_bulk('class' => LoadWorker, 'args' => arr)
|
96
|
+
arr = Array.new(count) { |idx| [idx] }
|
97
|
+
Sidekiq::Client.push_bulk("class" => LoadWorker, "args" => arr)
|
103
98
|
end
|
104
|
-
Sidekiq.logger.error "Created #{count*iter} jobs"
|
99
|
+
Sidekiq.logger.error "Created #{count * iter} jobs"
|
105
100
|
|
106
101
|
start = Time.now
|
107
102
|
|
108
103
|
Monitoring = Thread.new do
|
109
|
-
|
110
|
-
|
104
|
+
while true
|
105
|
+
sleep 0.2
|
106
|
+
qsize = Sidekiq.redis do |conn|
|
107
|
+
conn.llen "queue:default"
|
108
|
+
end
|
109
|
+
total = qsize
|
110
|
+
# Sidekiq.logger.error("RSS: #{Process.rss} Pending: #{total}")
|
111
|
+
if total == 0
|
112
|
+
Sidekiq.logger.error("Done, #{iter * count} jobs in #{Time.now - start} sec")
|
113
|
+
Sidekiq.logger.error("Now here's the latency for three jobs")
|
114
|
+
|
115
|
+
LoadWorker.perform_async(1, Time.now.to_f)
|
116
|
+
LoadWorker.perform_async(2, Time.now.to_f)
|
117
|
+
LoadWorker.perform_async(3, Time.now.to_f)
|
118
|
+
|
111
119
|
sleep 0.2
|
112
|
-
|
113
|
-
conn.llen "queue:default"
|
114
|
-
end
|
115
|
-
total = qsize
|
116
|
-
#Sidekiq.logger.error("RSS: #{Process.rss} Pending: #{total}")
|
117
|
-
if total == 0
|
118
|
-
Sidekiq.logger.error("Done, #{iter * count} jobs in #{Time.now - start} sec")
|
119
|
-
Sidekiq.logger.error("Now here's the latency for three jobs")
|
120
|
-
|
121
|
-
LoadWorker.perform_async(1, Time.now.to_f)
|
122
|
-
LoadWorker.perform_async(2, Time.now.to_f)
|
123
|
-
LoadWorker.perform_async(3, Time.now.to_f)
|
124
|
-
|
125
|
-
sleep 0.2
|
126
|
-
exit(0)
|
127
|
-
end
|
120
|
+
exit(0)
|
128
121
|
end
|
129
122
|
end
|
130
123
|
end
|
131
124
|
|
125
|
+
def with_latency(latency, &block)
|
126
|
+
Sidekiq.logger.error "Simulating #{latency}ms of latency between Sidekiq and redis"
|
127
|
+
if latency > 0
|
128
|
+
Toxiproxy[:redis].downstream(:latency, latency: latency).apply(&block)
|
129
|
+
else
|
130
|
+
yield
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
132
134
|
begin
|
133
|
-
#RubyProf::exclude_threads = [ Monitoring ]
|
134
|
-
#RubyProf.start
|
135
|
-
|
136
|
-
|
137
|
-
|
135
|
+
# RubyProf::exclude_threads = [ Monitoring ]
|
136
|
+
# RubyProf.start
|
137
|
+
events = Sidekiq.options[:lifecycle_events][:startup]
|
138
|
+
events.each(&:call)
|
139
|
+
events.clear
|
140
|
+
|
141
|
+
with_latency(Integer(ENV.fetch("LATENCY", "1"))) do
|
138
142
|
launcher = Sidekiq::Launcher.new(Sidekiq.options)
|
139
143
|
launcher.run
|
140
144
|
|
@@ -144,14 +148,14 @@ begin
|
|
144
148
|
end
|
145
149
|
end
|
146
150
|
rescue SystemExit => e
|
147
|
-
#Sidekiq.logger.error("Profiling...")
|
148
|
-
#result = RubyProf.stop
|
149
|
-
#printer = RubyProf::GraphHtmlPrinter.new(result)
|
150
|
-
#printer.print(File.new("output.html", "w"), :min_percent => 1)
|
151
|
+
# Sidekiq.logger.error("Profiling...")
|
152
|
+
# result = RubyProf.stop
|
153
|
+
# printer = RubyProf::GraphHtmlPrinter.new(result)
|
154
|
+
# printer.print(File.new("output.html", "w"), :min_percent => 1)
|
151
155
|
# normal
|
152
156
|
rescue => e
|
153
157
|
raise e if $DEBUG
|
154
|
-
|
155
|
-
|
158
|
+
warn e.message
|
159
|
+
warn e.backtrace.join("\n")
|
156
160
|
exit 1
|
157
161
|
end
|
data/bin/sidekiqmon
CHANGED
Binary file
|