sidekiq 7.1.5 → 7.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9e59dd929beab7b591592800b1b38d7683728b6f6b09e0c3a6b1e7c86ce524f
4
- data.tar.gz: 27009dd8f71c92bbde9378a4ee1b39a5122ad2c241a9ebb6b55ea295795c87be
3
+ metadata.gz: b50ab03f32263dd24ee37ce2ddadc7a4e5e226860146c1a677262dd3a417329d
4
+ data.tar.gz: 0af1051781796465d5ce5dd0d0e454016fdc04b7cb5fcf0b8d62e447faff11ed
5
5
  SHA512:
6
- metadata.gz: 10f292d33bb676892789806030f5e9d54d55bcbd7b22431e10f08b8fe7add524a712e16d9e03c8d1913538809468fdc3cff05cfd60188520ba0c015421d100b3
7
- data.tar.gz: ab4e2225a3aced675ad7bcd65dd377689c7bb2131a828eaab8044b9fbefa68516bac48fd0825f318a13559a797b3f0f547bb6681394aebf14c911bdcbf8817c9
6
+ metadata.gz: f2e84e49ceb024e8cb24a7213ffe81e40ed9423d646e39778ed51049bf89a04c28890a21e93eeb38bb9daefe88b94b150d71a0cdf80ecdad712a2167dd0a3421
7
+ data.tar.gz: 39ffc3e4eee3e2c27a3f774f2a2120c50a52ab9e2049b0fc925123c622553bf4fd19512c16e63882031909bba6ea5b2d15cf856256a3c453d080e89253196fc6
data/Changes.md CHANGED
@@ -2,6 +2,13 @@
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
+ 7.1.6
6
+ ----------
7
+
8
+ - The block forms of testing modes (inline, fake) are now thread-safe so you can have
9
+ a multithreaded test suite which uses different modes for different tests. [#6069]
10
+ - Fix breakage with non-Proc error handlers [#6065]
11
+
5
12
  7.1.5
6
13
  ----------
7
14
 
@@ -74,7 +74,7 @@ module Sidekiq
74
74
  #
75
75
  # Any options valid for a job class's sidekiq_options are also available here.
76
76
  #
77
- # All options must be strings, not symbols. NB: because we are serializing to JSON, all
77
+ # All keys must be strings, not symbols. NB: because we are serializing to JSON, all
78
78
  # symbols in 'args' will be converted to strings. Note that +backtrace: true+ can take quite a bit of
79
79
  # space in Redis; a large volume of failing jobs can start Redis swapping if you aren't careful.
80
80
  #
@@ -111,7 +111,7 @@ module Sidekiq
111
111
  # prevented a job push.
112
112
  #
113
113
  # Example (pushing jobs in batches):
114
- # push_bulk('class' => 'MyJob', 'args' => (1..100_000).to_a, batch_size: 1_000)
114
+ # push_bulk('class' => MyJob, 'args' => (1..100_000).to_a, batch_size: 1_000)
115
115
  #
116
116
  def push_bulk(items)
117
117
  batch_size = items.delete(:batch_size) || items.delete("batch_size") || 1_000
@@ -258,13 +258,18 @@ module Sidekiq
258
258
  @logger = logger
259
259
  end
260
260
 
261
+ private def arity(handler)
262
+ return handler.arity if handler.is_a?(Proc)
263
+ handler.method(:call).arity
264
+ end
265
+
261
266
  # INTERNAL USE ONLY
262
267
  def handle_exception(ex, ctx = {})
263
268
  if @options[:error_handlers].size == 0
264
269
  p ["!!!!!", ex]
265
270
  end
266
271
  @options[:error_handlers].each do |handler|
267
- if handler.arity == 2
272
+ if arity(handler) == 2
268
273
  # TODO Remove in 8.0
269
274
  logger.info { "DEPRECATION: Sidekiq exception handlers now take three arguments, see #{handler}" }
270
275
  handler.call(ex, {_config: self}.merge(ctx))
@@ -6,22 +6,35 @@ require "sidekiq"
6
6
  module Sidekiq
7
7
  class Testing
8
8
  class << self
9
- attr_accessor :__test_mode
9
+ attr_accessor :__global_test_mode
10
10
 
11
+ # Calling without a block sets the global test mode, affecting
12
+ # all threads. Calling with a block only affects the current Thread.
11
13
  def __set_test_mode(mode)
12
14
  if block_given?
13
- current_mode = __test_mode
14
15
  begin
15
- self.__test_mode = mode
16
+ self.__local_test_mode = mode
16
17
  yield
17
18
  ensure
18
- self.__test_mode = current_mode
19
+ self.__local_test_mode = nil
19
20
  end
20
21
  else
21
- self.__test_mode = mode
22
+ self.__global_test_mode = mode
22
23
  end
23
24
  end
24
25
 
26
+ def __test_mode
27
+ __local_test_mode || __global_test_mode
28
+ end
29
+
30
+ def __local_test_mode
31
+ Thread.current[:__sidekiq_test_mode]
32
+ end
33
+
34
+ def __local_test_mode=(value)
35
+ Thread.current[:__sidekiq_test_mode] = value
36
+ end
37
+
25
38
  def disable!(&block)
26
39
  __set_test_mode(:disable, &block)
27
40
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sidekiq
4
- VERSION = "7.1.5"
4
+ VERSION = "7.1.6"
5
5
  MAJOR = 7
6
6
  end
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.1.5
4
+ version: 7.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-02 00:00:00.000000000 Z
11
+ date: 2023-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-client
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  - !ruby/object:Gem::Version
224
224
  version: '0'
225
225
  requirements: []
226
- rubygems_version: 3.4.7
226
+ rubygems_version: 3.4.20
227
227
  signing_key:
228
228
  specification_version: 4
229
229
  summary: Simple, efficient background processing for Ruby