sidekiq 6.5.3 → 6.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46b428cecc373a6b11d27e12622dcfc8661b138e244c16575ad49362c672a60e
4
- data.tar.gz: 64fc302563e615eec63e8701b581949cb90738c799714257d98bbd6f359cff45
3
+ metadata.gz: 5a8c3c194984f6f100e1b71b92d200fa90660d07f0ad4c670285116ddba8bbfc
4
+ data.tar.gz: 97dd46ecc5728504e80ada9b15a3f26eab75cf18f1022630db29d19c9109219f
5
5
  SHA512:
6
- metadata.gz: 6b62cefbc386b0113ffe47ca4e10b6752cfd86d973c0a8143e116ad45e2e6c680f0de686c9e2750760c14c71f17e3c13375145ae16a98f6cceab96908ca4cf61
7
- data.tar.gz: 0dfc564242453b670e13e656098a3294e0c9831efa9520e025b08d3c265ef6cb148fb4519af78406a43d9972b9e83db1c9d8271ee7288f57401a5e7bb30d401e
6
+ metadata.gz: 8e5a7a1cf338064e2b900a3083cd124ee98cb0b8cc059e5aab07a572b2714ed1ce46b3149bbdd8808574daf41718d7f98f65825c98c447f194b4a64266991996
7
+ data.tar.gz: 67933e92a6d81c4b11f99b510b5b00b45224bef8babafa8918ab87108f194abc6e586b0e14239ccfa415ce22cae0cd6e94764cea630aa830acc21b50af862931
data/Changes.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  [Sidekiq Changes](https://github.com/mperham/sidekiq/blob/main/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/main/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/main/Ent-Changes.md)
4
4
 
5
+ 6.5.4
6
+ ----------
7
+
8
+ - Fix invalid code on Ruby 2.5 [#5460]
9
+ - Fix further metrics dependency issues [#5457]
10
+
5
11
  6.5.3
6
12
  ----------
7
13
 
data/lib/sidekiq/api.rb CHANGED
@@ -5,8 +5,11 @@ require "sidekiq"
5
5
  require "zlib"
6
6
  require "set"
7
7
  require "base64"
8
- require "sidekiq/metrics/deploy"
9
- require "sidekiq/metrics/query"
8
+
9
+ if ENV["SIDEKIQ_METRICS_BETA"]
10
+ require "sidekiq/metrics/deploy"
11
+ require "sidekiq/metrics/query"
12
+ end
10
13
 
11
14
  module Sidekiq
12
15
  # Retrieve runtime statistics from Redis regarding
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "sidekiq/scheduled"
4
- require "sidekiq/api"
5
-
6
3
  require "zlib"
7
4
  require "base64"
8
5
 
@@ -203,14 +200,13 @@ module Sidekiq
203
200
  nil
204
201
  end
205
202
 
206
- delay = if Integer === rv && rv > 0
207
- rv
203
+ delay = (count**4) + 15
204
+ if Integer === rv && rv > 0
205
+ delay = rv
208
206
  elsif rv == :discard
209
207
  return [:discard, nil] # do nothing, job goes poof
210
208
  elsif rv == :kill
211
209
  return [:kill, nil]
212
- else
213
- (count**4) + 15
214
210
  end
215
211
 
216
212
  [:default, delay]
@@ -236,7 +232,15 @@ module Sidekiq
236
232
  def send_to_morgue(msg)
237
233
  logger.info { "Adding dead #{msg["class"]} job #{msg["jid"]}" }
238
234
  payload = Sidekiq.dump_json(msg)
239
- DeadSet.new.kill(payload, notify_failure: false)
235
+ now = Time.now.to_f
236
+
237
+ config.redis do |conn|
238
+ conn.multi do |xa|
239
+ xa.zadd("dead", now.to_s, payload)
240
+ xa.zremrangebyscore("dead", "-inf", now - config[:dead_timeout_in_seconds])
241
+ xa.zremrangebyrank("dead", 0, - config[:dead_max_jobs])
242
+ end
243
+ end
240
244
  end
241
245
 
242
246
  def retry_attempts_from(msg_retry, default)
@@ -152,8 +152,14 @@ module Sidekiq
152
152
  job_hash = Sidekiq.load_json(jobstr)
153
153
  rescue => ex
154
154
  handle_exception(ex, {context: "Invalid JSON for job", jobstr: jobstr})
155
- # we can't notify because the job isn't a valid hash payload.
156
- DeadSet.new.kill(jobstr, notify_failure: false)
155
+ now = Time.now.to_f
156
+ config.redis do |conn|
157
+ conn.multi do |xa|
158
+ xa.zadd("dead", now.to_s, jobstr)
159
+ xa.zremrangebyscore("dead", "-inf", now - config[:dead_timeout_in_seconds])
160
+ xa.zremrangebyrank("dead", 0, - config[:dead_max_jobs])
161
+ end
162
+ end
157
163
  return uow.acknowledge
158
164
  end
159
165
 
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "sidekiq"
4
- require "sidekiq/api"
5
4
  require "sidekiq/component"
6
5
 
7
6
  module Sidekiq
@@ -183,13 +182,8 @@ module Sidekiq
183
182
  end
184
183
 
185
184
  def process_count
186
- # The work buried within Sidekiq::ProcessSet#cleanup can be
187
- # expensive at scale. Cut it down by 90% with this counter.
188
- # NB: This method is only called by the scheduler thread so we
189
- # don't need to worry about the thread safety of +=.
190
- pcount = Sidekiq::ProcessSet.new(@count_calls % 10 == 0).size
185
+ pcount = Sidekiq.redis { |conn| conn.scard("processes") }
191
186
  pcount = 1 if pcount == 0
192
- @count_calls += 1
193
187
  pcount
194
188
  end
195
189
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sidekiq
4
- VERSION = "6.5.3"
4
+ VERSION = "6.5.4"
5
5
  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: 6.5.3
4
+ version: 6.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-04 00:00:00.000000000 Z
11
+ date: 2022-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis