sidekiq 7.2.1 → 7.2.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 +6 -0
- data/README.md +2 -2
- data/bin/multi_queue_bench +41 -38
- data/lib/sidekiq/api.rb +3 -3
- data/lib/sidekiq/cli.rb +3 -1
- data/lib/sidekiq/job.rb +1 -1
- data/lib/sidekiq/logger.rb +1 -1
- data/lib/sidekiq/middleware/current_attributes.rb +1 -1
- data/lib/sidekiq/rails.rb +4 -0
- data/lib/sidekiq/redis_connection.rb +1 -3
- data/lib/sidekiq/transaction_aware_client.rb +7 -0
- data/lib/sidekiq/version.rb +1 -1
- data/lib/sidekiq/web/csrf_protection.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67dd3e4a49f94aa711fa9baa0caac22c992b5c0a6a04a1cade9426f9a4a9341b
|
4
|
+
data.tar.gz: 224649c4a61110b9600f70f3ccd568360642e74330fc7503f6ac03bc57f638dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20154e18f4d51e19b68946543f4523ac452f463ef7b8f2e4445bdb1d2bf518902e94edefc9d2a4f5771c33bdc5003b5b4b55fab05495d7756f90ebdc0bfbe0b9
|
7
|
+
data.tar.gz: 510fa35d3b8657b1e8e6b23bc940d0a32ae64d0e09331981728b23ea1548d2b000f1943ee39b2b2459500d86c4b3a3cd9a8bf2142ebd82ecdbdbfac75a0d521f
|
data/Changes.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
[Sidekiq Changes](https://github.com/sidekiq/sidekiq/blob/main/Changes.md) | [Sidekiq Pro Changes](https://github.com/sidekiq/sidekiq/blob/main/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/sidekiq/sidekiq/blob/main/Ent-Changes.md)
|
4
4
|
|
5
|
+
HEAD
|
6
|
+
----------
|
7
|
+
|
8
|
+
- Add `Process.warmup` call in Ruby 3.3+
|
9
|
+
- Batch jobs now skip transactional push [#6160]
|
10
|
+
|
5
11
|
7.2.1
|
6
12
|
----------
|
7
13
|
|
data/README.md
CHANGED
@@ -14,11 +14,11 @@ Rails to make background processing dead simple.
|
|
14
14
|
Requirements
|
15
15
|
-----------------
|
16
16
|
|
17
|
-
- Redis: 6.2+
|
17
|
+
- Redis: Redis 6.2+ or Dragonfly 1.13+
|
18
18
|
- Ruby: MRI 2.7+ or JRuby 9.3+.
|
19
19
|
|
20
20
|
Sidekiq 7.0 supports Rails 6.0+ but does not require it.
|
21
|
-
|
21
|
+
As of 7.2, Sidekiq supports Dragonfly as an alternative to Redis for data storage.
|
22
22
|
|
23
23
|
Installation
|
24
24
|
-----------------
|
data/bin/multi_queue_bench
CHANGED
@@ -120,9 +120,12 @@ class Loader
|
|
120
120
|
start = Time.now
|
121
121
|
@iter.times do
|
122
122
|
arr = Array.new(@count) { |idx| [idx] }
|
123
|
-
#always prepends
|
123
|
+
# Sidekiq always prepends "queue:" to the queue name,
|
124
|
+
# that's why we pass 'q1', 'q2', etc instead of 'queue:q1'
|
124
125
|
Sidekiq::Client.push_bulk("class" => LoadWorker, "args" => arr, "queue" => queue)
|
126
|
+
$stdout.write "."
|
125
127
|
end
|
128
|
+
puts "Done"
|
126
129
|
end
|
127
130
|
|
128
131
|
def monitor_single(queue)
|
@@ -176,7 +179,7 @@ class Loader
|
|
176
179
|
end
|
177
180
|
|
178
181
|
def run(queues, queue, monitor_all_queues)
|
179
|
-
|
182
|
+
Sidekiq.logger.warn("Consuming from #{queue}")
|
180
183
|
if monitor_all_queues
|
181
184
|
monitor_all(queues)
|
182
185
|
else
|
@@ -216,50 +219,50 @@ end
|
|
216
219
|
|
217
220
|
# We assign one queue to each sidekiq process
|
218
221
|
def run(number_of_processes, total_queues)
|
219
|
-
|
222
|
+
read_stream, write_stream = IO.pipe
|
220
223
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
224
|
+
queues = []
|
225
|
+
(0..total_queues-1).each do |idx|
|
226
|
+
queues.push("queue:q#{idx}")
|
227
|
+
end
|
225
228
|
|
226
|
-
|
229
|
+
Sidekiq.logger.info("Queues are: #{queues}")
|
227
230
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
end
|
231
|
+
# Produce
|
232
|
+
start = Time.now
|
233
|
+
(0..total_queues-1).each do |idx|
|
234
|
+
Process.fork do
|
235
|
+
queue_num = "q#{idx}"
|
236
|
+
setup(queue_num)
|
235
237
|
end
|
238
|
+
end
|
236
239
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
end
|
240
|
+
queue_sz = $iterations * $elements * total_queues
|
241
|
+
Process.waitall
|
242
|
+
|
243
|
+
ending = Time.now - start
|
244
|
+
#Sidekiq.logger.info("Pushed #{queue_sz} in #{ending} secs")
|
245
|
+
|
246
|
+
# Consume
|
247
|
+
(0..number_of_processes-1).each do |idx|
|
248
|
+
Process.fork do
|
249
|
+
# First process only consumes from it's own queue but monitors all queues.
|
250
|
+
# It works as a synchronization point. Once all processes finish
|
251
|
+
# (that is, when all queues are emptied) it prints the the stats.
|
252
|
+
if idx == 0
|
253
|
+
queue = "q#{idx}"
|
254
|
+
consume(queues, queue, true)
|
255
|
+
else
|
256
|
+
queue = "q#{idx % total_queues}"
|
257
|
+
consume(queues, queue, false)
|
256
258
|
end
|
257
259
|
end
|
260
|
+
end
|
258
261
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
262
|
+
Process.waitall
|
263
|
+
write_stream.close
|
264
|
+
results = read_stream.read
|
265
|
+
read_stream.close
|
263
266
|
end
|
264
267
|
|
265
268
|
$total_processes = ENV["PROCESSES"] ? Integer(ENV["PROCESSES"]) : 8;
|
data/lib/sidekiq/api.rb
CHANGED
@@ -773,7 +773,7 @@ module Sidekiq
|
|
773
773
|
#
|
774
774
|
class ScheduledSet < JobSet
|
775
775
|
def initialize
|
776
|
-
super
|
776
|
+
super("schedule")
|
777
777
|
end
|
778
778
|
end
|
779
779
|
|
@@ -787,7 +787,7 @@ module Sidekiq
|
|
787
787
|
#
|
788
788
|
class RetrySet < JobSet
|
789
789
|
def initialize
|
790
|
-
super
|
790
|
+
super("retry")
|
791
791
|
end
|
792
792
|
|
793
793
|
# Enqueues all jobs pending within the retry set.
|
@@ -808,7 +808,7 @@ module Sidekiq
|
|
808
808
|
#
|
809
809
|
class DeadSet < JobSet
|
810
810
|
def initialize
|
811
|
-
super
|
811
|
+
super("dead")
|
812
812
|
end
|
813
813
|
|
814
814
|
# Add the given job to the Dead set.
|
data/lib/sidekiq/cli.rb
CHANGED
@@ -38,7 +38,7 @@ module Sidekiq # :nodoc:
|
|
38
38
|
# Code within this method is not tested because it alters
|
39
39
|
# global process state irreversibly. PRs which improve the
|
40
40
|
# test coverage of Sidekiq::CLI are welcomed.
|
41
|
-
def run(boot_app: true)
|
41
|
+
def run(boot_app: true, warmup: true)
|
42
42
|
boot_application if boot_app
|
43
43
|
|
44
44
|
if environment == "development" && $stdout.tty? && @config.logger.formatter.is_a?(Sidekiq::Logger::Formatters::Pretty)
|
@@ -101,6 +101,8 @@ module Sidekiq # :nodoc:
|
|
101
101
|
# Touch middleware so it isn't lazy loaded by multiple threads, #3043
|
102
102
|
@config.server_middleware
|
103
103
|
|
104
|
+
::Process.warmup if warmup && ::Process.respond_to?(:warmup)
|
105
|
+
|
104
106
|
# Before this point, the process is initializing with just the main thread.
|
105
107
|
# Starting here the process will now have multiple threads running.
|
106
108
|
fire_event(:startup, reverse: false, reraise: true)
|
data/lib/sidekiq/job.rb
CHANGED
@@ -109,7 +109,7 @@ module Sidekiq
|
|
109
109
|
m = "#{name}="
|
110
110
|
undef_method(m) if method_defined?(m) || private_method_defined?(m)
|
111
111
|
end
|
112
|
-
define_singleton_method("#{name}=") do |val|
|
112
|
+
define_singleton_method(:"#{name}=") do |val|
|
113
113
|
singleton_class.class_eval do
|
114
114
|
ACCESSOR_MUTEX.synchronize do
|
115
115
|
undef_method(synchronized_getter) if method_defined?(synchronized_getter) || private_method_defined?(synchronized_getter)
|
data/lib/sidekiq/logger.rb
CHANGED
data/lib/sidekiq/rails.rb
CHANGED
@@ -9,7 +9,14 @@ module Sidekiq
|
|
9
9
|
@redis_client = Client.new(pool: pool, config: config)
|
10
10
|
end
|
11
11
|
|
12
|
+
def batching?
|
13
|
+
Thread.current[:sidekiq_batch]
|
14
|
+
end
|
15
|
+
|
12
16
|
def push(item)
|
17
|
+
# 6160 we can't support both Sidekiq::Batch and transactions.
|
18
|
+
return @redis_client.push(item) if batching?
|
19
|
+
|
13
20
|
# pre-allocate the JID so we can return it immediately and
|
14
21
|
# save it to the database as part of the transaction.
|
15
22
|
item["jid"] ||= SecureRandom.hex(12)
|
data/lib/sidekiq/version.rb
CHANGED
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: 7.2.
|
4
|
+
version: 7.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Perham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-client
|