sidekiq 5.0.0.beta3 → 5.0.0.rc1

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
  SHA1:
3
- metadata.gz: 59a5749b8cc8c03928f8c9666277388001a44429
4
- data.tar.gz: e6c8f820c0ea4d8942cf192a51fe0ca2afbc054f
3
+ metadata.gz: 6d7e0b4092aa035c45d6dd4893cd470bb9a249d6
4
+ data.tar.gz: fbb9d06f9875133960daf397b8c338ca74c2d225
5
5
  SHA512:
6
- metadata.gz: bf5423a3a9753e8dd014446d2f33b926b5388bcc6b8b34b2e26fe9b467a7b1e3d19e4490becee438c6f57ebcfbfea40ae51e3ffe3d8d23522e7db35ccde95c04
7
- data.tar.gz: 16e37b35e549e4007bf7e4fa1fb4079a019a8f9bd22256d96175d09b5e9747c1bb63a77b2521256d5a25634d00a36c66463c420c3ec1cdd6b0646f6d2974a8f0
6
+ metadata.gz: f1dd673960ace0f7e30a09bb480de64265a64b997042b65c8cb0057757129def2005c75b6f017c3b5fb589681c2f2180e2f0b8f698f4ac63ef9bf44b641ad426
7
+ data.tar.gz: d9a1a3270d371bf7d7bddf98d103e6be2886a4dd6acbb08c1d5edd7b951b7f8d91d11e56c0892e10c6e6981f028ea8d64db5900cef0c3cb4023b91a9adbb30cd
@@ -33,11 +33,12 @@ versions of Ruby and Rails and adds support for RTL languages in the Web UI.
33
33
  * The Web UI is now bi-directional - it can render either LTR
34
34
  (left-to-right) or RTL languages. With this change, **Farsi, Arabic,
35
35
  Hebrew and Urdu** are officially supported. [#3381]
36
- * Rails 3.2 is no longer supported.
37
- * Ruby 2.0 and Ruby 2.1 are no longer supported. Ruby 2.2.2+ is required.
38
36
  * Jobs which can't be parsed due to invalid JSON are now pushed
39
37
  immediately to the Dead set since they require manual intervention and
40
- will never execute successfully as is. [#3296]
38
+ will never execute successfully as is. The Web UI has been updated to
39
+ more gracefully display these jobs. [#3296]
40
+ * **Rails 3.2** is no longer supported.
41
+ * **Ruby 2.0 and Ruby 2.1** are no longer supported. Ruby 2.2.2+ is required.
41
42
 
42
43
  ## Upgrade
43
44
 
@@ -6,6 +6,7 @@ Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how t
6
6
  HEAD
7
7
  ---------
8
8
 
9
+ - Re-implement `Sidekiq::Queue#delete_job` to avoid O(n) runtime [#3408]
9
10
  - Batch page displays Pending JIDs if less than 10 [#3130]
10
11
  - Batch page has a Search button to find associated Retries [#3130]
11
12
  - Make Batch UI progress bar more friendly to the colorblind [#3387]
@@ -75,7 +75,7 @@ module Sidekiq
75
75
  enqueued = pipe2_res[s..-1].map(&:to_i).inject(0, &:+)
76
76
 
77
77
  default_queue_latency = if (entry = pipe1_res[6].first)
78
- job = Sidekiq.load_json(entry)
78
+ job = Sidekiq.load_json(entry) rescue {}
79
79
  now = Time.now.to_f
80
80
  thence = job['enqueued_at'.freeze] || now
81
81
  now - thence
@@ -287,13 +287,21 @@ module Sidekiq
287
287
  attr_reader :value
288
288
 
289
289
  def initialize(item, queue_name=nil)
290
+ @args = nil
290
291
  @value = item
291
- @item = if item.is_a?(Hash)
292
- item
293
- else
294
- Sidekiq.load_json(item) rescue nil
295
- end
296
- @queue = queue_name || self['queue']
292
+ @item = item.is_a?(Hash) ? item : parse(item)
293
+ @queue = queue_name || @item['queue']
294
+ end
295
+
296
+ def parse(item)
297
+ Sidekiq.load_json(item)
298
+ rescue JSON::ParserError
299
+ # If the job payload in Redis is invalid JSON, we'll load
300
+ # the item as an empty hash and store the invalid JSON as
301
+ # the job 'args' for display in the Web UI.
302
+ @invalid = true
303
+ @args = [item]
304
+ {}
297
305
  end
298
306
 
299
307
  def klass
@@ -341,7 +349,7 @@ module Sidekiq
341
349
  end
342
350
 
343
351
  def args
344
- self['args']
352
+ @args || @item['args']
345
353
  end
346
354
 
347
355
  def jid
@@ -48,6 +48,7 @@ module Sidekiq
48
48
  # queue - the named queue to use, default 'default'
49
49
  # class - the worker class to call, required
50
50
  # args - an array of simple arguments to the perform method, must be JSON-serializable
51
+ # at - timestamp to schedule the job (optional), must be Numeric (e.g. Time.now.to_f)
51
52
  # retry - whether to retry this job if it fails, default true or an integer number of retries
52
53
  # backtrace - whether to save any error backtrace, default false
53
54
  #
@@ -212,6 +213,7 @@ module Sidekiq
212
213
  raise(ArgumentError, "Job must be a Hash with 'class' and 'args' keys: { 'class' => SomeWorker, 'args' => ['bob', 1, :foo => 'bar'] }") unless item.is_a?(Hash) && item.has_key?('class'.freeze) && item.has_key?('args'.freeze)
213
214
  raise(ArgumentError, "Job args must be an Array") unless item['args'].is_a?(Array)
214
215
  raise(ArgumentError, "Job class must be either a Class or String representation of the class name") unless item['class'.freeze].is_a?(Class) || item['class'.freeze].is_a?(String)
216
+ raise(ArgumentError, "Job 'at' must be a Numeric timestamp") if item.has_key?('at'.freeze) && !item['at'].is_a?(Numeric)
215
217
  #raise(ArgumentError, "Arguments must be native JSON types, see https://github.com/mperham/sidekiq/wiki/Best-Practices") unless JSON.load(JSON.dump(item['args'])) == item['args']
216
218
 
217
219
  normalized_hash(item['class'.freeze])
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Sidekiq
3
- VERSION = "5.0.0.beta3"
3
+ VERSION = "5.0.0.rc1"
4
4
  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: 5.0.0.beta3
4
+ version: 5.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-22 00:00:00.000000000 Z
11
+ date: 2017-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis