resque-retry 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3424ef6139214b3f9ec367393e92e2da6ac888eb
4
- data.tar.gz: 85ba61ab491cadba2783e34e3af7d05953e02f53
3
+ metadata.gz: 105706892be947dafeb239f354c775e3bcb8df9d
4
+ data.tar.gz: 43c4248749336f1dd2a56fd561fcc0f56676ab30
5
5
  SHA512:
6
- metadata.gz: 6424ef718b680bfd61cc7fa47ddc1c09ae397c5a9838fbeee01fa4af5ff79001c06052f982ab517aa8f2db73d7e1f99323ca41ad4df54d328897f104ea07bfaf
7
- data.tar.gz: 840b6f3402ee1bf8e708ab78d6f7f376aac96f0ef843ff5d08c9668ed1771d69b6a51a819216be8f5611013e0cfdda9f30575ec1d330ec97af304f359298963e
6
+ metadata.gz: a6cc62c680c943615e628f65e64e7391bd8db8b8f9257ce8080690650bd55e7a0812e8ecc62001a8a608d1f82f9daa92ef6ca36c5498d6094f01a327a3d8f126
7
+ data.tar.gz: baf25c455e64044e2b3849df250d1b9a594b278b83903f41703d04a6c2b0ac56d3ec9ef6aa7bcadb0a672b658bd1251f8169b9f90893ed925754b265954b856e
data/.travis.yml CHANGED
@@ -3,8 +3,7 @@ language: ruby
3
3
  matrix:
4
4
  allow_failures:
5
5
  - rvm: jruby-19mode
6
- - rvm: jruby-20mode
7
- - rvm: rbx
6
+ - rvm: rbx-2
8
7
 
9
8
  rvm:
10
9
  - 1.9.3
@@ -12,5 +11,4 @@ rvm:
12
11
  - 2.1.0
13
12
  - 2.1.1
14
13
  - jruby-19mode
15
- - jruby-20mode
16
- - rbx
14
+ - rbx-2
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## HEAD
2
2
 
3
+ ## 1.2.1 (2014-06-09)
4
+
5
+ * Fixed Kernel.rand: "invalid argument - 0.0 (ArgumentError)" error with "ExponentialBackoff" (on "Rubinius") when `retry_delay_multiplicand_min` and `retry_delay_multiplicand_max` were the same value (@saizai)
6
+
3
7
  ## 1.2.0 (2014-05-19)
4
8
 
5
9
  * Fixed scenario where job does not get retried correctly when `perform` is not called as expected.
data/README.md CHANGED
@@ -413,9 +413,9 @@ Contributing/Pull Requests
413
413
  * Fork the project.
414
414
  * Make your feature addition or bug fix.
415
415
  * Add tests for it.
416
- * Commit.
417
- * Send me a pull request. Bonus points for topic branches.
418
- * If you edit the gemspec/version etc, do it in another commit please.
416
+ * In a seperate commit, update the HISTORY.md file please.
417
+ * Send us a pull request. Bonus points for topic branches.
418
+ * If you edit the gemspec/version etc, please do so in another commit.
419
419
 
420
420
  [god]: http://github.com/mojombo/god
421
421
  [rq]: http://github.com/defunkt/resque
@@ -1,3 +1,3 @@
1
1
  module ResqueRetry
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
@@ -81,8 +81,14 @@ module Resque
81
81
  # @api private
82
82
  def retry_delay
83
83
  delay = backoff_strategy[retry_attempt] || backoff_strategy.last
84
- delay_multiplicand = \
85
- rand(retry_delay_multiplicand_min..retry_delay_multiplicand_max)
84
+ # if the values are the same don't bother generating a random number, if
85
+ # the delta is zero, some platforms will raise an error
86
+ if retry_delay_multiplicand_min == retry_delay_multiplicand_max
87
+ delay_multiplicand = retry_delay_multiplicand_max
88
+ else
89
+ delay_multiplicand = \
90
+ rand(retry_delay_multiplicand_min..retry_delay_multiplicand_max)
91
+ end
86
92
  (delay * delay_multiplicand).to_i
87
93
  end
88
94
 
@@ -41,7 +41,7 @@ class MultipleFailureTest < MiniTest::Unit::TestCase
41
41
  perform_next_job(@worker)
42
42
 
43
43
  assert_equal 1, MockFailureBackend.errors.count, 'should have one error'
44
- assert_match /uninitialized constant LimitThreeJobTemp/, MockFailureBackend.errors.first
44
+ assert_match /uninitialized constant.* LimitThreeJobTemp/, MockFailureBackend.errors.first
45
45
  end
46
46
 
47
47
  def test_last_failure_is_saved_in_redis_if_delay
data/test/retry_test.rb CHANGED
@@ -285,4 +285,23 @@ class RetryTest < MiniTest::Unit::TestCase
285
285
  Resque.enqueue(ExpiringJob, 'expiry_test')
286
286
  perform_next_job(@worker)
287
287
  end
288
+
289
+ if Process.respond_to?(:fork) && Gem::Version.new(Resque::VERSION) >= Gem::Version.new('1.20.0')
290
+ def test_retry_on_dirty_exit
291
+ Resque.enqueue(RetryKilledJob)
292
+ RetryKilledJob.expects(:clean_retry_key).once
293
+ 2.times do
294
+ job = @worker.reserve
295
+ child = fork do
296
+ Resque.redis.client.reconnect
297
+ job.perform
298
+ end
299
+ Process.waitpid(child)
300
+ job.fail(Resque::DirtyExit.new)
301
+ end
302
+
303
+ assert_equal nil, @worker.reserve
304
+ end
305
+ end
306
+
288
307
  end
data/test/test_jobs.rb CHANGED
@@ -474,3 +474,13 @@ class FailsDuringConnectJob < RetryDefaultsJob
474
474
  @retry_limit = 3
475
475
  @retry_delay = 10
476
476
  end
477
+
478
+
479
+ class RetryKilledJob
480
+ extend Resque::Plugins::Retry
481
+ @queue = :testing
482
+
483
+ def self.perform(*args)
484
+ Process.kill("KILL", Process.pid)
485
+ end
486
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-retry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Antins
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-05-19 00:00:00.000000000 Z
13
+ date: 2014-06-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: resque