sidekiq 7.3.0 → 7.3.2

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: 34279eae9b8159c48dd31c7b088341136d8b785e7b853389e29e179443af1577
4
- data.tar.gz: 520c6f705995df5c8e50e4e607956bcd8fe78d332e9a33fdf7a4ff25b7534f60
3
+ metadata.gz: ce4653de61d5b923ce7556490e95cf6918dd1c94340417ec4093f11cc8ceda39
4
+ data.tar.gz: e9faa23d4535a5b647c5dc86c28ce64317ea964f44faa9141b5a883f77b80dcd
5
5
  SHA512:
6
- metadata.gz: 939c535c352b1c9390e7675d75cfc3728685282187c0edd8475373c6bad1ee67391477a46e26ea3de06724e8cf2570ef759862eb37234c1f9d53f79adafd5947
7
- data.tar.gz: 1a127bf11d514789f6ec808f964d47e9d459687a5b2d91ebe468d6a59a28c5f9dbf01203e1aee583311c776ca9caa41831d74a15557adf5bb0bd71cce27cffdd
6
+ metadata.gz: 5fa259f415261689936b4f03f179198ea6849fbe63b932b5836fa800714055ce574a80a56462355a92d125440362957ebf02e5bafbde55fe8211805c80573ae5
7
+ data.tar.gz: 0aaf341ae13c377e6f944344e0feef246e3450ae9eb0d74fcbf8e932e9c9fcf0d8f0dd56ce374064d4f51c4d99f4c306560c3283db27f70ae6aa5af346d83ec3
data/Changes.md CHANGED
@@ -2,6 +2,22 @@
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.2
6
+ ----------
7
+
8
+ - Adjust ActiveRecord batch iteration to restart an interrupted batch from the beginning.
9
+ Each batch should be processed as a single transaction in order to be idempotent. [#6405]
10
+ - Fix typo in S::DeadSet#kill [#6397]
11
+ - Fix CSS issue with bottom bar in Web UI [#6414]
12
+
13
+ 7.3.1
14
+ ----------
15
+
16
+ - Don't count job interruptions as failures in metrics [#6386]
17
+ - Add frozen string literal to a number of .rb files.
18
+ - Fix frozen string error with style_tag and script_tag [#6371]
19
+ - Fix an error on Ruby 2.7 because of usage of `Hash#except` [#6376]
20
+
5
21
  7.3.0
6
22
  ----------
7
23
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rails/generators/named_base"
2
4
 
3
5
  module Sidekiq
data/lib/sidekiq/api.rb CHANGED
@@ -813,6 +813,8 @@ module Sidekiq
813
813
 
814
814
  # Add the given job to the Dead set.
815
815
  # @param message [String] the job data as JSON
816
+ # @option opts [Boolean] :notify_failure (true) Whether death handlers should be called
817
+ # @option opts [Exception] :ex (RuntimeError) An exception to pass to the death handlers
816
818
  def kill(message, opts = {})
817
819
  now = Time.now.to_f
818
820
  Sidekiq.redis do |conn|
@@ -825,10 +827,14 @@ module Sidekiq
825
827
 
826
828
  if opts[:notify_failure] != false
827
829
  job = Sidekiq.load_json(message)
828
- r = RuntimeError.new("Job killed by API")
829
- r.set_backtrace(caller)
830
+ if opts[:ex]
831
+ ex = opts[:ex]
832
+ else
833
+ ex = RuntimeError.new("Job killed by API")
834
+ ex.set_backtrace(caller)
835
+ end
830
836
  Sidekiq.default_configuration.death_handlers.each do |handle|
831
- handle.call(job, r)
837
+ handle.call(job, ex)
832
838
  end
833
839
  end
834
840
  true
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "sidekiq/component"
2
4
 
3
5
  module Sidekiq
@@ -251,7 +251,10 @@ module Sidekiq
251
251
  at = hash["at"].to_s
252
252
  # ActiveJob sets this but the job has not been enqueued yet
253
253
  hash.delete("enqueued_at")
254
- [at, Sidekiq.dump_json(hash.except("at"))]
254
+ # TODO: Use hash.except("at") when support for Ruby 2.7 is dropped
255
+ hash = hash.dup
256
+ hash.delete("at")
257
+ [at, Sidekiq.dump_json(hash)]
255
258
  })
256
259
  else
257
260
  queue = payloads.first["queue"]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "forwardable"
2
4
 
3
5
  require "set"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "sidekiq/redis_connection"
2
4
  require "time"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "sidekiq/component"
2
4
  require "sidekiq/launcher"
3
5
  require "sidekiq/metrics/tracking"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "sidekiq/job/iterable"
2
4
 
3
5
  # Iterable jobs are ones which provide a sequence to process using
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Sidekiq
2
4
  module Job
3
5
  class InterruptHandler
@@ -22,7 +22,7 @@ module Sidekiq
22
22
  def batches
23
23
  Enumerator.new(-> { @relation.count }) do |yielder|
24
24
  @relation.find_in_batches(**@options, start: @cursor) do |batch|
25
- yielder.yield(batch, batch.last.id)
25
+ yielder.yield(batch, batch.first.id)
26
26
  end
27
27
  end
28
28
  end
@@ -35,8 +35,8 @@ module Sidekiq
35
35
  options[:of] ||= options.delete(:batch_size)
36
36
 
37
37
  @relation.in_batches(**options, start: @cursor) do |relation|
38
- last_record = relation.last
39
- yielder.yield(relation, last_record.id)
38
+ first_record = relation.first
39
+ yielder.yield(relation, first_record.id)
40
40
  end
41
41
  end
42
42
  end
@@ -2,17 +2,15 @@
2
2
 
3
3
  module Sidekiq
4
4
  class JobLogger
5
- include Sidekiq::Component
6
-
7
5
  def initialize(config)
8
6
  @config = config
9
- @logger = logger
7
+ @logger = @config.logger
10
8
  end
11
9
 
12
10
  # If true we won't do any job logging out of the box.
13
11
  # The user is responsible for any logging.
14
12
  def skip_default_logging?
15
- config[:skip_default_job_logging]
13
+ @config[:skip_default_job_logging]
16
14
  end
17
15
 
18
16
  def call(item, queue)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "securerandom"
2
4
  require "time"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "sidekiq"
2
4
  require "date"
3
5
  require "set"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "concurrent"
2
4
 
3
5
  module Sidekiq
@@ -31,11 +31,11 @@ module Sidekiq
31
31
  # We don't track time for failed jobs as they can have very unpredictable
32
32
  # execution times. more important to know average time for successful jobs so we
33
33
  # can better recognize when a perf regression is introduced.
34
- @lock.synchronize {
35
- @grams[klass].record_time(time_ms)
36
- @jobs["#{klass}|ms"] += time_ms
37
- @totals["ms"] += time_ms
38
- }
34
+ track_time(klass, time_ms)
35
+ rescue JobRetry::Skip
36
+ # This is raised when iterable job is interrupted.
37
+ track_time(klass, time_ms)
38
+ raise
39
39
  rescue Exception
40
40
  @lock.synchronize {
41
41
  @jobs["#{klass}|f"] += 1
@@ -100,6 +100,14 @@ module Sidekiq
100
100
 
101
101
  private
102
102
 
103
+ def track_time(klass, time_ms)
104
+ @lock.synchronize {
105
+ @grams[klass].record_time(time_ms)
106
+ @jobs["#{klass}|ms"] += time_ms
107
+ @totals["ms"] += time_ms
108
+ }
109
+ end
110
+
103
111
  def reset
104
112
  @lock.synchronize {
105
113
  array = [@totals, @jobs, @grams]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "active_support/current_attributes"
2
4
 
3
5
  module Sidekiq
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Sidekiq
2
4
  # Server-side middleware must import this Module in order
3
5
  # to get access to server resources during `call`.
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "fileutils"
4
5
  require "sidekiq/api"
@@ -98,7 +99,7 @@ class Sidekiq::Monitor
98
99
  pad = opts[:pad] || 0
99
100
  max_length = opts[:max_length] || (80 - pad)
100
101
  out = []
101
- line = ""
102
+ line = +""
102
103
  values.each do |value|
103
104
  if (line.length + value.length) > max_length
104
105
  out << line
@@ -66,7 +66,14 @@ module Sidekiq
66
66
  scrubbed_options[:password] = redacted if scrubbed_options[:password]
67
67
  scrubbed_options[:sentinel_password] = redacted if scrubbed_options[:sentinel_password]
68
68
  scrubbed_options[:sentinels]&.each do |sentinel|
69
- sentinel[:password] = redacted if sentinel[:password]
69
+ if sentinel.is_a?(String)
70
+ if (uri = URI(sentinel)) && uri.password
71
+ uri.password = redacted
72
+ sentinel.replace(uri.to_s)
73
+ end
74
+ elsif sentinel[:password]
75
+ sentinel[:password] = redacted
76
+ end
70
77
  end
71
78
  scrubbed_options
72
79
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "forwardable"
2
4
 
3
5
  module Sidekiq
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Sidekiq's systemd integration allows Sidekiq to inform systemd:
3
5
  # 1. when it has successfully started
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sidekiq
4
- VERSION = "7.3.0"
4
+ VERSION = "7.3.2"
5
5
  MAJOR = 7
6
6
  end
@@ -428,7 +428,8 @@ module Sidekiq
428
428
  Rack::CONTENT_TYPE => "text/html",
429
429
  Rack::CACHE_CONTROL => "private, no-store",
430
430
  Web::CONTENT_LANGUAGE => action.locale,
431
- Web::CONTENT_SECURITY_POLICY => process_csp(env, CSP_HEADER_TEMPLATE)
431
+ Web::CONTENT_SECURITY_POLICY => process_csp(env, CSP_HEADER_TEMPLATE),
432
+ Web::X_CONTENT_TYPE_OPTIONS => "nosniff"
432
433
  }
433
434
  # we'll let Rack calculate Content-Length for us.
434
435
  [200, headers, [resp]]
@@ -36,7 +36,7 @@ module Sidekiq
36
36
  # NB: keys and values are not escaped; do not allow user input
37
37
  # in the attributes
38
38
  private def html_tag(tagname, attrs)
39
- s = "<#{tagname}"
39
+ s = +"<#{tagname}"
40
40
  attrs.each_pair do |k, v|
41
41
  next unless v
42
42
  s << " #{k}=\"#{v}\""
data/lib/sidekiq/web.rb CHANGED
@@ -40,11 +40,13 @@ module Sidekiq
40
40
  CONTENT_SECURITY_POLICY = "Content-Security-Policy"
41
41
  LOCATION = "Location"
42
42
  X_CASCADE = "X-Cascade"
43
+ X_CONTENT_TYPE_OPTIONS = "X-Content-Type-Options"
43
44
  else
44
45
  CONTENT_LANGUAGE = "content-language"
45
46
  CONTENT_SECURITY_POLICY = "content-security-policy"
46
47
  LOCATION = "location"
47
48
  X_CASCADE = "x-cascade"
49
+ X_CONTENT_TYPE_OPTIONS = "x-content-type-options"
48
50
  end
49
51
 
50
52
  class << self
@@ -634,12 +634,8 @@ div.interval-slider input {
634
634
  .container {
635
635
  padding: 0;
636
636
  }
637
- .navbar-fixed-bottom {
638
- position: relative;
639
- top: auto;
640
- }
641
637
  @media (max-width: 767px) {
642
- .navbar-fixed-top {
638
+ .navbar-fixed-top, .navbar-fixed-bottom {
643
639
  position: relative;
644
640
  top: auto;
645
641
  }
@@ -652,18 +648,18 @@ div.interval-slider input {
652
648
 
653
649
  @media (min-width: 768px) {
654
650
  .redis-url {
655
- max-width: 250px;
651
+ max-width: 160px;
656
652
  }
657
653
  }
658
654
 
659
655
  @media (min-width: 992px) {
660
656
  .redis-url {
661
- max-width: 490px;
657
+ max-width: 380px;
662
658
  }
663
659
  }
664
660
  @media (min-width: 1200px) {
665
661
  .redis-url {
666
- max-width: 600px;
662
+ max-width: 580px;
667
663
  }
668
664
  }
669
665
 
data/web/locales/tr.yml CHANGED
@@ -4,7 +4,7 @@ tr:
4
4
  AddToQueue: Kuyruğa ekle
5
5
  AreYouSure: Emin misiniz?
6
6
  AreYouSureDeleteJob: Bu işi silmek istediğinizden emin misiniz?
7
- AreYouSureDeleteQueue: %{queue} kuyruğunu silmek istediğinizden emin misiniz?
7
+ AreYouSureDeleteQueue: "%{queue} kuyruğunu silmek istediğinizden emin misiniz?"
8
8
  Arguments: Argümanlar
9
9
  BackToApp: Uygulamaya geri dön
10
10
  Busy: Meşgul
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.3.0
4
+ version: 7.3.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-07-01 00:00:00.000000000 Z
11
+ date: 2024-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-client