sidekiq 8.0.4 → 8.0.6

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: 70244790b6f984dfb4da9922e5971f3072479bce2f484ca3ab3982108906e6d0
4
- data.tar.gz: 77b5d8e952603bebfe6e703b0f92df3cf4b78be6caf7e46fb46e5376c02c45c7
3
+ metadata.gz: d76e142e5c120dc7d714ae218813bc6d3488064c291a407f0fbddc3b65b03d77
4
+ data.tar.gz: db1326f0b7553125f67a9667811cc32e7768343fe2684d3aec2adef107e4e586
5
5
  SHA512:
6
- metadata.gz: 5c347f189e4ed255a1de061afa5c08bf73b3d77f83d853669e09c9b7e06f430958d1db4e3aa9a6ae3a9abad5802c3872f050ae43b2db014105633c45be4cfaa0
7
- data.tar.gz: 0fca2e77cfd25ab7ccc6be20edeb8a0c09056c8bb0bde03de5ff415a5ca15f55668e1c662a2f91c1dfe8ed074ae5d106d95b1d3a04e32fa1d86606aa35c06645
6
+ metadata.gz: 99e54bdfb34e9fe257b740917cd675d959eac98566a15d53f65638095d7fe6da2966efbfd9d958c9c580034b4af49adb9cd3c94cd189b39fb7360a021f471714
7
+ data.tar.gz: afedc02f36f45de8e65fe58d897ae11f7aaa9f105f9b87c2f47b01dbcc501087d5c9d2dcf3c436bc3427ec801371c43a8f7c92741e30d87cc91fad9dc34ba429
data/Changes.md CHANGED
@@ -2,6 +2,23 @@
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
+ 8.0.6
6
+ ----------
7
+
8
+ - Adjust transactional client to use ActiveRecord 7.2's support for
9
+ `after_all_transactions_commit` when available. [#6765, rewritten]
10
+ - Fix Rails 7.0 and 7.1 compatibility [#6746, mlarraz]
11
+ - Flush metrics at `:exit` [#6764]
12
+
13
+ 8.0.5
14
+ ----------
15
+
16
+ - Add `stopping?` method to AJ adapter for compatibility with the new AJ::Continuations feature [#6732]
17
+ - Further improvements to Rails boot compatibility [#6710]
18
+ - Add ability to disable CSRF middleware. SameSite cookies prevent
19
+ CSRF in a cleaner manner and are default in most browsers now.
20
+ CSRF code will be removed in Sidekiq 9.0. [#6739]
21
+
5
22
  8.0.4
6
23
  ----------
7
24
 
@@ -17,7 +17,7 @@ begin
17
17
  end
18
18
  end
19
19
 
20
- unless ActiveJob::Base.respond_to?(:sidekiq_options)
20
+ ActiveSupport.on_load(:active_job) do
21
21
  # By including the Options module, we allow AJs to directly control sidekiq features
22
22
  # via the *sidekiq_options* class method and, for instance, not use AJ's retry system.
23
23
  # AJ retries don't show up in the Sidekiq UI Retries tab, don't save any error data, can't be
@@ -29,7 +29,7 @@ begin
29
29
  # def perform
30
30
  # end
31
31
  # end
32
- ActiveJob::Base.include Sidekiq::Job::Options
32
+ include Sidekiq::Job::Options unless respond_to?(:sidekiq_options)
33
33
  end
34
34
 
35
35
  # Patch the ActiveJob module
@@ -43,7 +43,15 @@ begin
43
43
  # To use Sidekiq set the queue_adapter config to +:sidekiq+.
44
44
  #
45
45
  # Rails.application.config.active_job.queue_adapter = :sidekiq
46
- class SidekiqAdapter
46
+ parent = const_defined?(:AbstractAdapter) ? AbstractAdapter : Object
47
+ class SidekiqAdapter < parent
48
+ @@stopping = false
49
+
50
+ callback = -> { @@stopping = true }
51
+
52
+ Sidekiq.configure_client { |config| config.on(:quiet, &callback) }
53
+ Sidekiq.configure_server { |config| config.on(:quiet, &callback) }
54
+
47
55
  # Defines whether enqueuing should happen implicitly to after commit when called
48
56
  # from inside a transaction.
49
57
  # @api private
@@ -99,10 +107,12 @@ begin
99
107
  enqueued_count
100
108
  end
101
109
 
110
+ # @api private
111
+ def stopping? = !!@@stopping
112
+
102
113
  # Defines a class alias for backwards compatibility with enqueued Active Job jobs.
103
114
  # @api private
104
- class JobWrapper < Sidekiq::ActiveJob::Wrapper
105
- end
115
+ JobWrapper = Sidekiq::ActiveJob::Wrapper
106
116
  end
107
117
  end
108
118
  end
@@ -147,4 +147,7 @@ Sidekiq.configure_server do |config|
147
147
  config.on(:beat) do
148
148
  exec.flush
149
149
  end
150
+ config.on(:exit) do
151
+ exec.flush
152
+ end
150
153
  end
data/lib/sidekiq/rails.rb CHANGED
@@ -1,12 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "sidekiq/job"
4
- require_relative "../active_job/queue_adapters/sidekiq_adapter"
5
-
6
3
  module Sidekiq
7
4
  begin
8
5
  gem "railties", ">= 7.0"
9
6
  require "rails"
7
+ require "sidekiq/job"
8
+ require_relative "../active_job/queue_adapters/sidekiq_adapter"
10
9
 
11
10
  class Rails < ::Rails::Engine
12
11
  class Reloader
@@ -83,7 +83,7 @@ module Sidekiq
83
83
  class EmptyQueueError < RuntimeError; end
84
84
 
85
85
  module TestingClient
86
- def atomic_push(conn, payloads)
86
+ private def atomic_push(conn, payloads)
87
87
  if Sidekiq::Testing.fake?
88
88
  payloads.each do |job|
89
89
  job = Sidekiq.load_json(Sidekiq.dump_json(job))
@@ -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 = "8.0.4"
4
+ VERSION = "8.0.6"
5
5
  MAJOR = 8
6
6
 
7
7
  def self.gem_version
@@ -67,7 +67,31 @@ module Sidekiq
67
67
  end
68
68
 
69
69
  def session
70
- env["rack.session"]
70
+ env["rack.session"] || fail(<<~EOM)
71
+ Sidekiq::Web needs a valid Rack session. If this is a Rails app, make
72
+ sure you mount Sidekiq::Web *inside* your application routes:
73
+
74
+
75
+ Rails.application.routes.draw do
76
+ mount Sidekiq::Web => "/sidekiq"
77
+ ....
78
+ end
79
+
80
+
81
+ If this is a Rails app in API mode, you need to enable sessions.
82
+
83
+ https://guides.rubyonrails.org/api_app.html#using-session-middlewares
84
+
85
+ If this is a bare Rack app, use a session middleware before Sidekiq::Web:
86
+
87
+ # first, use IRB to create a shared secret key for sessions and commit it
88
+ require 'securerandom'; File.open(".session.key", "w") {|f| f.write(SecureRandom.hex(32)) }
89
+
90
+ # now use the secret with a session cookie middleware
91
+ use Rack::Session::Cookie, secret: File.read(".session.key"), same_site: true, max_age: 86400
92
+ run Sidekiq::Web
93
+
94
+ EOM
71
95
  end
72
96
 
73
97
  def logger
@@ -24,7 +24,10 @@ module Sidekiq
24
24
  # and very difficult for us to vendor or provide ourselves. If you are worried
25
25
  # about data security and wish to self-host, you can change these URLs.
26
26
  profile_view_url: "https://profiler.firefox.com/public/%s",
27
- profile_store_url: "https://api.profiler.firefox.com/compressed-store"
27
+ profile_store_url: "https://api.profiler.firefox.com/compressed-store",
28
+ # Will be false in Sidekiq 9.0.
29
+ # CSRF is unnecessary if you are using SameSite=(Strict|Lax) cookies.
30
+ csrf: true
28
31
  }
29
32
 
30
33
  ##
data/lib/sidekiq/web.rb CHANGED
@@ -109,7 +109,7 @@ module Sidekiq
109
109
  cascade: true,
110
110
  header_rules: rules
111
111
  m.each { |middleware, block| use(*middleware, &block) }
112
- use CsrfProtection unless $TESTING # rubocop:disable Style/GlobalVars
112
+ use CsrfProtection if cfg[:csrf]
113
113
  run Sidekiq::Web::Application.new(self.class)
114
114
  end
115
115
  end
@@ -567,6 +567,7 @@ body > footer .nav {
567
567
  --color-border: oklch(25% 0.01 256);
568
568
  --color-input-border: oklch(31% 0.01 256);
569
569
  --color-selected: oklch(27% 0.01 256);
570
+ --color-selected-text: oklch(55% 0.11 45);
570
571
  --color-table-bg-alt: oklch(24% 0.01 256);
571
572
  --color-shadow: oklch(9% 0.01 256 / 10%);
572
573
  --color-text: oklch(75% 0.01 256);
@@ -615,6 +616,10 @@ body > footer .nav {
615
616
  .label-info { background: var(--color-info); }
616
617
  .label-danger { background: var(--color-danger); }
617
618
  .label-warning { background: var(--color-warning); }
619
+
620
+ td.box::selection {
621
+ background-color: var(--color-selected-text);
622
+ }
618
623
  }
619
624
 
620
625
  @media (max-width: 800px) { :root { --font-size: 14px; } }
@@ -758,4 +763,4 @@ body > footer .nav {
758
763
  text-align: center;
759
764
  padding: 20px;
760
765
  background: var(--color-success);
761
- }
766
+ }
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: 8.0.4
4
+ version: 8.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-28 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
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  - !ruby/object:Gem::Version
245
245
  version: '0'
246
246
  requirements: []
247
- rubygems_version: 3.6.2
247
+ rubygems_version: 3.6.9
248
248
  specification_version: 4
249
249
  summary: Simple, efficient background processing for Ruby
250
250
  test_files: []