sidekiq 3.3.2 → 3.3.3

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: 66911189b7648f87bf3ce6e11f5917d6b242ddcc
4
- data.tar.gz: e21cbc6d3f73a9a25df7f2771248205ba457f453
3
+ metadata.gz: 4895c316f5c9f592745594ac4984e150fbf5ea62
4
+ data.tar.gz: b78f6b9242d8a981a60d3fbe28a08c3c16b839af
5
5
  SHA512:
6
- metadata.gz: 16d3851a53e70a270cfd7277817953fa54897dabf0f4f527308bcbcb769d4232d98466bac1477f820472a7cac361326da5563e696481f7a2963471c6cd3119b8
7
- data.tar.gz: c687ab3be80e972fd2b98c6d2939c7509506a8516495eabb81d4ae92c6ec939203a28e4bfea99925bd8469f8035f8024010cc6e992aef97e9adc74a256b4b9c4
6
+ metadata.gz: 9134b87eee18dc46b1e95d9190ee3a3f0d5b9426f5b6953d9b55aee39d9fd6e2441b9133fa797e137d8cfdc50c6e99fbff1c74195fe065ff3d84b4e8869333fe
7
+ data.tar.gz: 23767242d2d5911526cae5b5061d050a363947cc9f21f7dbc336eb6d5605ab470a0733b2ab6979e33b3dd81969bdd282958ce69f8a6a3a4683fdceb71dfcc4a1
@@ -7,10 +7,10 @@ rvm:
7
7
  - 2.1
8
8
  - 2.0.0
9
9
  - 2.2
10
- - jruby-19mode
11
10
  - jruby
11
+ - jruby-head
12
12
  - rbx-2
13
13
  matrix:
14
14
  allow_failures:
15
15
  - rvm: rbx-2
16
- - rvm: jruby
16
+ - rvm: jruby-head
@@ -24,6 +24,8 @@ You may not, without Our prior written consent, redistribute the Software or Mod
24
24
 
25
25
  You may not redistribute the Software as part of a product, "appliance" or "virtual server". You may not redistribute the Software on any server which is not directly under Your control.
26
26
 
27
+ You may not publicize your unique "Source URL" for Sidekiq Pro. If your unique Source URL is ever publicized, We reserve the right to terminate your access without notice.
28
+
27
29
  UNDER NO CIRCUMSTANCES MAY YOU USE THE SOFTWARE FOR A PRODUCT THAT IS INTENDED FOR SOFTWARE OR APPLICATION DEVELOPMENT PURPOSES.
28
30
 
29
31
  The Open Source version of the Software (“LGPL Version”) is licensed
data/Changes.md CHANGED
@@ -1,3 +1,10 @@
1
+ 3.3.3
2
+ -----------
3
+
4
+ - Fix crash on exit when Redis is down [#2235]
5
+ - Fix duplicate logging on startup
6
+ - Undeprecate delay extension for ActionMailer 4.2+ . [#2186]
7
+
1
8
  3.3.2
2
9
  -----------
3
10
 
@@ -15,6 +15,9 @@ available.
15
15
  **Note that you CANNOT go back to Pro 1.x once you've created batches
16
16
  with 2.x. The new batches will not process correctly with 1.x.**
17
17
 
18
+ **If you are on a version of Sidekiq Pro <1.5, you should upgrade to the
19
+ latest 1.x version and run it for a week before upgrading to 2.0.**
20
+
18
21
  ## Nested Batches
19
22
 
20
23
  Batches can now be nested within the `jobs` method.
@@ -35,7 +38,7 @@ a.jobs do
35
38
  end
36
39
  ```
37
40
 
38
- Parent batch callbacks are not processed until any child batch callbacks have
41
+ Parent batch callbacks are not processed until all child batch callbacks have
39
42
  run successfully. In the example above, `MyCallback` will always fire
40
43
  before `SomeCallback` because `b` is considered a child of `a`.
41
44
 
@@ -58,6 +61,8 @@ def perform(*args)
58
61
  end
59
62
  ```
60
63
 
64
+ More context: [#1485]
65
+
61
66
  ## Batch Data
62
67
 
63
68
  The batch data model was overhauled. Batch data should take
@@ -78,14 +83,22 @@ savings but real world savings should be even greater.
78
83
  **There's no data migration required. Sidekiq Pro 2.0 transparently handles
79
84
  both old and new format.**
80
85
 
86
+ More context: [#2130]
87
+
81
88
  ## Reliability
82
89
 
83
90
  2.0 brings a new reliable scheduler which uses Lua inside Redis so enqueuing
84
91
  scheduled jobs is atomic. Benchmarks show it 50x faster when enqueuing
85
- lots of jobs. **One caveat**: client-side middleware is not executed
86
- for each job when enqueued with the reliable scheduler. No Sidekiq or
87
- Sidekiq Pro functionality is affected by this change but some 3rd party
88
- plugins might be.
92
+ lots of jobs.
93
+
94
+ **Two caveats**:
95
+ - Client-side middleware is not executed
96
+ for each job when enqueued with the reliable scheduler. No Sidekiq or
97
+ Sidekiq Pro functionality is affected by this change but some 3rd party
98
+ plugins might be.
99
+ - The Lua script used inside the reliable scheduler is not safe for use
100
+ with Redis Cluster, Redis Sentinel or other distributed Redis solutions.
101
+ It is safe to use with a typical master/slave replication setup.
89
102
 
90
103
  **You no longer require anything to use the Reliability features.**
91
104
 
@@ -101,6 +114,8 @@ end
101
114
  Sidekiq::Client.reliable_push!
102
115
  ```
103
116
 
117
+ More context: [#2130]
118
+
104
119
  ## Other Changes
105
120
 
106
121
  * You must require `sidekiq/pro/notifications` if you want to use the
@@ -109,7 +124,13 @@ Sidekiq::Client.reliable_push!
109
124
  * Several classes have been renamed. Generally these classes are ones
110
125
  you should not need to require/use in your own code, e.g. the Batch
111
126
  middleware.
112
- * The Web UI now shows the Sidekiq Pro version in the footer.
127
+ * You can add `attr_accessor :jid` to a Batch callback class and Sidekiq
128
+ Pro will set it to the jid of the callback job. [#2178]
129
+ * There's now an official API to iterate all known Batches [#2191]
130
+ ```ruby
131
+ Sidekiq::BatchSet.new.each {|status| p status.bid }
132
+ ```
133
+ * The Web UI now shows the Sidekiq Pro version in the footer. [#1991]
113
134
 
114
135
  ## Thanks
115
136
 
@@ -4,7 +4,15 @@ Sidekiq Pro Changelog
4
4
  Please see [http://sidekiq.org/pro](http://sidekiq.org/pro) for more details and how to buy.
5
5
 
6
6
 
7
- 2.0.0 (unreleased)
7
+ 2.0.1
8
+ -----------
9
+
10
+ - Add `batch.callback_queue` so batch callbacks can use a higher
11
+ priority queue than jobs. [#2200]
12
+ - Gracefully recover if someone runs `SCRIPT FLUSH` on Redis. [#2240]
13
+ - Ignore errors when attempting `bulk_requeue`, allowing clean shutdown
14
+
15
+ 2.0.0
8
16
  -----------
9
17
 
10
18
  - See [the Upgrade Notes](Pro-2.0-Upgrade.md) for detailed notes.
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  Sidekiq
2
2
  ==============
3
3
 
4
- [![Gem Version](https://badge.fury.io/rb/sidekiq.png)](https://rubygems.org/gems/sidekiq)
5
- [![Code Climate](https://codeclimate.com/github/mperham/sidekiq.png)](https://codeclimate.com/github/mperham/sidekiq)
6
- [![Build Status](https://travis-ci.org/mperham/sidekiq.png)](https://travis-ci.org/mperham/sidekiq)
7
- [![Coverage Status](https://coveralls.io/repos/mperham/sidekiq/badge.png?branch=master)](https://coveralls.io/r/mperham/sidekiq)
8
- [![Gitter Chat](https://badges.gitter.im/mperham/sidekiq.png)](https://gitter.im/mperham/sidekiq)
4
+ [![Gem Version](https://badge.fury.io/rb/sidekiq.svg)](https://rubygems.org/gems/sidekiq)
5
+ [![Code Climate](https://codeclimate.com/github/mperham/sidekiq.svg)](https://codeclimate.com/github/mperham/sidekiq)
6
+ [![Build Status](https://travis-ci.org/mperham/sidekiq.svg)](https://travis-ci.org/mperham/sidekiq)
7
+ [![Coverage Status](https://coveralls.io/repos/mperham/sidekiq/badge.svg?branch=master)](https://coveralls.io/r/mperham/sidekiq)
8
+ [![Gitter Chat](https://badges.gitter.im/mperham/sidekiq.svg)](https://gitter.im/mperham/sidekiq)
9
9
 
10
10
 
11
11
  Simple, efficient background processing for Ruby.
@@ -46,7 +46,7 @@ Getting Started
46
46
  -----------------
47
47
 
48
48
  See the [sidekiq home page](http://sidekiq.org) for the simple 3-step process.
49
- You can watch [Railscast #366](http://railscasts.com/episodes/366-sidekiq) to see Sidekiq in action. If you do everything right, you should see this:
49
+ You can watch [Railscast #366](http://railscasts.com/episodes/366-sidekiq) to see Sidekiq in action. If you do everything right, you should see this:
50
50
 
51
51
  ![Web UI](https://github.com/mperham/sidekiq/raw/master/examples/web-ui.png)
52
52
 
@@ -218,7 +218,7 @@ module Sidekiq
218
218
  Time.now.to_f - Sidekiq.load_json(entry)['enqueued_at']
219
219
  end
220
220
 
221
- def each(&block)
221
+ def each
222
222
  initial_size = size
223
223
  deleted_size = 0
224
224
  page = 0
@@ -233,14 +233,14 @@ module Sidekiq
233
233
  break if entries.empty?
234
234
  page += 1
235
235
  entries.each do |entry|
236
- block.call Job.new(entry, @name)
236
+ yield Job.new(entry, @name)
237
237
  end
238
238
  deleted_size = initial_size - size
239
239
  end
240
240
  end
241
241
 
242
242
  def find_job(jid)
243
- self.detect { |j| j.jid == jid }
243
+ detect { |j| j.jid == jid }
244
244
  end
245
245
 
246
246
  def clear
@@ -341,7 +341,7 @@ module Sidekiq
341
341
  def safe_load(content, default)
342
342
  begin
343
343
  yield(*YAML.load(content))
344
- rescue ::ArgumentError => ex
344
+ rescue => ex
345
345
  # #1761 in dev mode, it's possible to have jobs enqueued which haven't been loaded into
346
346
  # memory yet so the YAML can't be loaded.
347
347
  Sidekiq.logger.warn "Unable to load YAML: #{ex.message}" unless Sidekiq.options[:environment] == 'development'
@@ -474,7 +474,7 @@ module Sidekiq
474
474
  end
475
475
  end
476
476
 
477
- def each(&block)
477
+ def each
478
478
  initial_size = @_size
479
479
  offset_size = 0
480
480
  page = -1
@@ -489,7 +489,7 @@ module Sidekiq
489
489
  break if elements.empty?
490
490
  page -= 1
491
491
  elements.each do |element, score|
492
- block.call SortedEntry.new(self, score, element)
492
+ yield SortedEntry.new(self, score, element)
493
493
  end
494
494
  offset_size = initial_size - @_size
495
495
  end
@@ -651,7 +651,7 @@ module Sidekiq
651
651
  count
652
652
  end
653
653
 
654
- def each(&block)
654
+ def each
655
655
  procs = Sidekiq.redis { |conn| conn.smembers('processes') }.sort
656
656
 
657
657
  Sidekiq.redis do |conn|
@@ -760,7 +760,7 @@ module Sidekiq
760
760
  class Workers
761
761
  include Enumerable
762
762
 
763
- def each(&block)
763
+ def each
764
764
  Sidekiq.redis do |conn|
765
765
  procs = conn.smembers('processes')
766
766
  procs.sort.each do |key|
@@ -68,6 +68,11 @@ module Sidekiq
68
68
 
69
69
  fire_event(:startup)
70
70
 
71
+ Sidekiq.redis do |conn|
72
+ # touch the connection pool so it is created before we
73
+ # launch the actors.
74
+ end
75
+
71
76
  if !options[:daemon]
72
77
  logger.info 'Starting processing, hit Ctrl-C to stop'
73
78
  end
@@ -28,7 +28,6 @@ module Sidekiq
28
28
 
29
29
  def deliver(msg)
30
30
  if msg.respond_to?(:deliver_now)
31
- ActiveSupport::Deprecation.warn('`ActionMailer.delay.method` is deprecated. Use `ActionMailer.method.deliver_later` instead and configure ActiveJob to use Sidekiq.')
32
31
  # Rails 4.2/5.0
33
32
  msg.deliver_now
34
33
  else
@@ -90,6 +90,8 @@ module Sidekiq
90
90
  conn.del("#{identity}:workers")
91
91
  end
92
92
  end
93
+ rescue
94
+ # best effort, ignore network errors
93
95
  end
94
96
 
95
97
  end
@@ -120,11 +120,11 @@ module Sidekiq
120
120
  entries.clear
121
121
  end
122
122
 
123
- def invoke(*args, &final_action)
123
+ def invoke(*args)
124
124
  chain = retrieve.dup
125
125
  traverse_chain = lambda do
126
126
  if chain.empty?
127
- final_action.call
127
+ yield
128
128
  else
129
129
  chain.shift.call(*args, &traverse_chain)
130
130
  end
@@ -50,7 +50,7 @@ module Sidekiq
50
50
  #
51
51
  # Sidekiq.configure_server do |config|
52
52
  # config.server_middleware do |chain|
53
- # chain.add Middleware::Server::RetryJobs, :max_retries => 7
53
+ # chain.add Sidekiq::Middleware::Server::RetryJobs, :max_retries => 7
54
54
  # end
55
55
  # end
56
56
  #
@@ -1,3 +1,3 @@
1
1
  module Sidekiq
2
- VERSION = "3.3.2"
2
+ VERSION = "3.3.3"
3
3
  end
@@ -42,13 +42,13 @@ module Sidekiq
42
42
 
43
43
  def perform_in(interval, *args)
44
44
  int = interval.to_f
45
- now = Time.now.to_f
46
- ts = (int < 1_000_000_000 ? now + int : int)
45
+ now = Time.now
46
+ ts = (int < 1_000_000_000 ? (now + interval).to_f : int)
47
47
 
48
48
  item = { 'class' => self, 'args' => args, 'at' => ts }
49
49
 
50
50
  # Optimization to enqueue something now that is scheduled to go out now or in the past
51
- item.delete('at'.freeze) if ts <= now
51
+ item.delete('at'.freeze) if ts <= now.to_f
52
52
 
53
53
  client_push(item)
54
54
  end
@@ -24,7 +24,7 @@ class TestApi < Sidekiq::Test
24
24
  describe "failed" do
25
25
  it "is initially zero" do
26
26
  s = Sidekiq::Stats.new
27
- assert_equal 0, s.processed
27
+ assert_equal 0, s.failed
28
28
  end
29
29
 
30
30
  it "returns number of failed jobs" do
@@ -311,8 +311,6 @@ class TestApi < Sidekiq::Test
311
311
  add_retry('bob1', same_time)
312
312
  add_retry('bob2', same_time)
313
313
  r = Sidekiq::RetrySet.new
314
- # jobs = r.fetch(same_time)
315
- # puts jobs[1].jid
316
314
  assert_equal 1, r.fetch(same_time, 'bob1').size
317
315
  end
318
316
 
@@ -30,6 +30,15 @@ class TestScheduling < Sidekiq::Test
30
30
  @redis.verify
31
31
  end
32
32
 
33
+ it 'schedules a job in one month' do
34
+ @redis.expect :zadd, true do |key, args|
35
+ assert_equal 'schedule', key
36
+ assert_in_delta 1.month.since.to_f, args[0][0].to_f, 1
37
+ end
38
+ assert ScheduledWorker.perform_in(1.month, 'mike')
39
+ @redis.verify
40
+ end
41
+
33
42
  it 'schedules a job via timestamp' do
34
43
  @redis.expect :zadd, true, ['schedule', Array]
35
44
  assert ScheduledWorker.perform_in(5.days.from_now, 'mike')
@@ -692,3 +692,15 @@ div.interval-slider input {
692
692
  top: auto;
693
693
  }
694
694
  }
695
+
696
+ .redis-url
697
+ {
698
+ max-width: 400px;
699
+ overflow: hidden;
700
+ }
701
+
702
+ .redis-namespace
703
+ {
704
+ max-width: 250px;
705
+ overflow: hidden;
706
+ }
@@ -6,14 +6,14 @@
6
6
  <p class="navbar-text" style="color:white;"><%= product_version %></p>
7
7
  </li>
8
8
  <li>
9
- <p class="navbar-text">Redis: <%= redis_connection %></p>
9
+ <p class="navbar-text redis-url">Redis: <%= redis_connection %></p>
10
10
  </li>
11
11
  <li>
12
12
  <p class="navbar-text"><%= t('Time') %>: <%= Time.now.utc.strftime('%H:%M:%S UTC') %></p>
13
13
  </li>
14
14
  <% if namespace %>
15
15
  <li>
16
- <p class="navbar-text"><%= t('Namespace') %>: <%= namespace %></p>
16
+ <p class="navbar-text redis-namespace"><%= t('Namespace') %>: <%= namespace %></p>
17
17
  </li>
18
18
  <% end %>
19
19
  </ul>
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: 3.3.2
4
+ version: 3.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-05 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis