sidekiq 7.3.9 → 7.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dccc402e8f4e309a47a2adb62418fa29989012e8c94f34aa11200b098dc375f2
4
- data.tar.gz: 71b64a582d5971b045d60bae38dc26da265b60ff9a099ca3b2f9c7df9035e805
3
+ metadata.gz: 8c8347f3f2281d531c67cac5b8d00a38baa08c2fa144d111e0d380c9520e1d88
4
+ data.tar.gz: 70f09f133c258fa1239d98f294e66ba9fba21dbb55573a76510d128b795b0180
5
5
  SHA512:
6
- metadata.gz: d9148b613a222ca9617ceebe25bb04a5d086edacdafad4a426b6232662d3b583db462dc5e0491297f7859037c5166bcb541bddcd3949f6d3b5a1c2e3fc572b65
7
- data.tar.gz: 93a797cefd1a68adb236c7538c28571467c328d6965af0bc5ce505a1391d6f5b6e2ae2c87b42110e837dcfa8d788aff55309806bbb1bcd181e205c3bc66adc29
6
+ metadata.gz: 308446f60faf0b6c180c62562f8e787e68f7654d9339e4c43b0219013b952a945e728117c8b8121d57a91fc1cb71eeecb560779f29579801d76f9a33fdaac963
7
+ data.tar.gz: '0392876234c063d8d9a2ecc10c6e2a79bd8dfea10fa4d547fb9046c134917d6aa958b9c7946c95797c6dc75ebfc694c52cd8e30602a5598d093e75281ce0f03f'
data/Changes.md CHANGED
@@ -2,6 +2,14 @@
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.3.10
6
+ ----------
7
+
8
+ - Allow Redis :password as a Proc [#6625]
9
+ `config.redis = { password: ->(username) { "password" } }`
10
+ - Bump required redis-client version to 0.23
11
+ - Lock dependencies to known good major versions
12
+
5
13
  7.3.9
6
14
  ----------
7
15
 
data/lib/sidekiq/fetch.rb CHANGED
@@ -7,6 +7,7 @@ require "sidekiq/capsule"
7
7
  module Sidekiq # :nodoc:
8
8
  class BasicFetch
9
9
  include Sidekiq::Component
10
+
10
11
  # We want the fetch operation to timeout every few seconds so the thread
11
12
  # can check if the process is shutting down.
12
13
  TIMEOUT = 2
@@ -11,6 +11,7 @@ module Sidekiq::Middleware::I18n
11
11
  # to be sent to Sidekiq.
12
12
  class Client
13
13
  include Sidekiq::ClientMiddleware
14
+
14
15
  def call(_jobclass, job, _queue, _redis)
15
16
  job["locale"] ||= I18n.locale
16
17
  yield
@@ -20,6 +21,7 @@ module Sidekiq::Middleware::I18n
20
21
  # Pull the msg locale out and set the current thread to use it.
21
22
  class Server
22
23
  include Sidekiq::ServerMiddleware
24
+
23
25
  def call(_jobclass, job, _queue, &block)
24
26
  I18n.with_locale(job.fetch("locale", I18n.default_locale), &block)
25
27
  end
@@ -10,6 +10,8 @@ module Sidekiq
10
10
  def create(options = {})
11
11
  symbolized_options = deep_symbolize_keys(options)
12
12
  symbolized_options[:url] ||= determine_redis_provider
13
+ symbolized_options[:password] = wrap(symbolized_options[:password]) if symbolized_options.key?(:password)
14
+ symbolized_options[:sentinel_password] = wrap(symbolized_options[:sentinel_password]) if symbolized_options.key?(:sentinel_password)
13
15
 
14
16
  logger = symbolized_options.delete(:logger)
15
17
  logger&.info { "Sidekiq #{Sidekiq::VERSION} connecting to Redis with options #{scrub(symbolized_options)}" }
@@ -38,6 +40,15 @@ module Sidekiq
38
40
 
39
41
  private
40
42
 
43
+ # Wrap hard-coded passwords in a Proc to avoid logging the value
44
+ def wrap(pwd)
45
+ if pwd.is_a?(String)
46
+ ->(username) { pwd }
47
+ else
48
+ pwd
49
+ end
50
+ end
51
+
41
52
  def deep_symbolize_keys(object)
42
53
  case object
43
54
  when Hash
@@ -57,14 +68,14 @@ module Sidekiq
57
68
  # Deep clone so we can muck with these options all we want and exclude
58
69
  # params from dump-and-load that may contain objects that Marshal is
59
70
  # unable to safely dump.
60
- keys = options.keys - [:logger, :ssl_params]
71
+ keys = options.keys - [:logger, :ssl_params, :password, :sentinel_password]
61
72
  scrubbed_options = Marshal.load(Marshal.dump(options.slice(*keys)))
62
73
  if scrubbed_options[:url] && (uri = URI.parse(scrubbed_options[:url])) && uri.password
63
74
  uri.password = redacted
64
75
  scrubbed_options[:url] = uri.to_s
65
76
  end
66
- scrubbed_options[:password] = redacted if scrubbed_options[:password]
67
- scrubbed_options[:sentinel_password] = redacted if scrubbed_options[:sentinel_password]
77
+ scrubbed_options[:password] = redacted if options.key?(:password)
78
+ scrubbed_options[:sentinel_password] = redacted if options.key?(:sentinel_password)
68
79
  scrubbed_options[:sentinels]&.each do |sentinel|
69
80
  if sentinel.is_a?(String)
70
81
  if (uri = URI(sentinel)) && uri.password
@@ -6,6 +6,7 @@ module Sidekiq
6
6
  class RingBuffer
7
7
  include Enumerable
8
8
  extend Forwardable
9
+
9
10
  def_delegators :@buf, :[], :each, :size
10
11
 
11
12
  def initialize(size, default = 0)
@@ -7,6 +7,12 @@ module Sidekiq
7
7
  class TransactionAwareClient
8
8
  def initialize(pool: nil, config: nil)
9
9
  @redis_client = Client.new(pool: pool, config: config)
10
+ @transaction_backend =
11
+ if ActiveRecord.version >= Gem::Version.new("7.2")
12
+ ActiveRecord.method(:after_all_transactions_commit)
13
+ else
14
+ AfterCommitEverywhere.method(:after_commit)
15
+ end
10
16
  end
11
17
 
12
18
  def batching?
@@ -20,7 +26,7 @@ module Sidekiq
20
26
  # pre-allocate the JID so we can return it immediately and
21
27
  # save it to the database as part of the transaction.
22
28
  item["jid"] ||= SecureRandom.hex(12)
23
- AfterCommitEverywhere.after_commit { @redis_client.push(item) }
29
+ @transaction_backend.call { @redis_client.push(item) }
24
30
  item["jid"]
25
31
  end
26
32
 
@@ -38,10 +44,12 @@ end
38
44
  # Use `Sidekiq.transactional_push!` in your sidekiq.rb initializer
39
45
  module Sidekiq
40
46
  def self.transactional_push!
41
- begin
42
- require "after_commit_everywhere"
43
- rescue LoadError
44
- raise %q(You need to add `gem "after_commit_everywhere"` to your Gemfile to use Sidekiq's transactional client)
47
+ if ActiveRecord.version < Gem::Version.new("7.2")
48
+ begin
49
+ require "after_commit_everywhere"
50
+ rescue LoadError
51
+ raise %q(You need ActiveRecord >= 7.2 or to add `gem "after_commit_everywhere"` to your Gemfile to use Sidekiq's transactional client)
52
+ end
45
53
  end
46
54
 
47
55
  Sidekiq.default_job_options["client_class"] = Sidekiq::TransactionAwareClient
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sidekiq
4
- VERSION = "7.3.9"
4
+ VERSION = "7.3.10"
5
5
  MAJOR = 7
6
6
 
7
7
  def self.gem_version
@@ -55,7 +55,7 @@ module Sidekiq
55
55
  end
56
56
 
57
57
  get "/" do
58
- @redis_info = redis_info.select { |k, v| REDIS_KEYS.include? k }
58
+ @redis_info = redis_info.slice(*REDIS_KEYS)
59
59
  days = (params["days"] || 30).to_i
60
60
  return halt(401) if days < 1 || days > 180
61
61
 
@@ -328,7 +328,7 @@ module Sidekiq
328
328
 
329
329
  get "/stats" do
330
330
  sidekiq_stats = Sidekiq::Stats.new
331
- redis_stats = redis_info.select { |k, v| REDIS_KEYS.include? k }
331
+ redis_stats = redis_info.slice(*REDIS_KEYS)
332
332
  json(
333
333
  sidekiq: {
334
334
  processed: sidekiq_stats.processed,
@@ -347,7 +347,7 @@ module Sidekiq
347
347
  elsif rss_kb < 10_000_000
348
348
  "#{number_with_delimiter((rss_kb / 1024.0).to_i)} MB"
349
349
  else
350
- "#{number_with_delimiter((rss_kb / (1024.0 * 1024.0)), precision: 1)} GB"
350
+ "#{number_with_delimiter(rss_kb / (1024.0 * 1024.0), precision: 1)} GB"
351
351
  end
352
352
  end
353
353
 
data/sidekiq.gemspec CHANGED
@@ -23,9 +23,9 @@ Gem::Specification.new do |gem|
23
23
  "rubygems_mfa_required" => "true"
24
24
  }
25
25
 
26
- gem.add_dependency "redis-client", ">= 0.22.2"
27
- gem.add_dependency "connection_pool", ">= 2.3.0"
28
- gem.add_dependency "rack", ">= 2.2.4"
26
+ gem.add_dependency "redis-client", ">= 0.23.0", "<1"
27
+ gem.add_dependency "connection_pool", ">= 2.3.0", "<3"
28
+ gem.add_dependency "rack", ">= 2.2.4", "<3.3"
29
29
  gem.add_dependency "logger"
30
30
  gem.add_dependency "base64"
31
31
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.9
4
+ version: 7.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-14 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: redis-client
@@ -15,14 +15,20 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 0.22.2
18
+ version: 0.23.0
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '1'
19
22
  type: :runtime
20
23
  prerelease: false
21
24
  version_requirements: !ruby/object:Gem::Requirement
22
25
  requirements:
23
26
  - - ">="
24
27
  - !ruby/object:Gem::Version
25
- version: 0.22.2
28
+ version: 0.23.0
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '1'
26
32
  - !ruby/object:Gem::Dependency
27
33
  name: connection_pool
28
34
  requirement: !ruby/object:Gem::Requirement
@@ -30,6 +36,9 @@ dependencies:
30
36
  - - ">="
31
37
  - !ruby/object:Gem::Version
32
38
  version: 2.3.0
39
+ - - "<"
40
+ - !ruby/object:Gem::Version
41
+ version: '3'
33
42
  type: :runtime
34
43
  prerelease: false
35
44
  version_requirements: !ruby/object:Gem::Requirement
@@ -37,6 +46,9 @@ dependencies:
37
46
  - - ">="
38
47
  - !ruby/object:Gem::Version
39
48
  version: 2.3.0
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: '3'
40
52
  - !ruby/object:Gem::Dependency
41
53
  name: rack
42
54
  requirement: !ruby/object:Gem::Requirement
@@ -44,6 +56,9 @@ dependencies:
44
56
  - - ">="
45
57
  - !ruby/object:Gem::Version
46
58
  version: 2.2.4
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.3'
47
62
  type: :runtime
48
63
  prerelease: false
49
64
  version_requirements: !ruby/object:Gem::Requirement
@@ -51,6 +66,9 @@ dependencies:
51
66
  - - ">="
52
67
  - !ruby/object:Gem::Version
53
68
  version: 2.2.4
69
+ - - "<"
70
+ - !ruby/object:Gem::Version
71
+ version: '3.3'
54
72
  - !ruby/object:Gem::Dependency
55
73
  name: logger
56
74
  requirement: !ruby/object:Gem::Requirement
@@ -244,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
262
  - !ruby/object:Gem::Version
245
263
  version: '0'
246
264
  requirements: []
247
- rubygems_version: 3.6.2
265
+ rubygems_version: 3.6.9
248
266
  specification_version: 4
249
267
  summary: Simple, efficient background processing for Ruby
250
268
  test_files: []