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 +4 -4
- data/.travis.yml +2 -4
- data/HISTORY.md +4 -0
- data/README.md +3 -3
- data/lib/resque-retry/version.rb +1 -1
- data/lib/resque/plugins/exponential_backoff.rb +8 -2
- data/test/multiple_failure_test.rb +1 -1
- data/test/retry_test.rb +19 -0
- data/test/test_jobs.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 105706892be947dafeb239f354c775e3bcb8df9d
|
4
|
+
data.tar.gz: 43c4248749336f1dd2a56fd561fcc0f56676ab30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6cc62c680c943615e628f65e64e7391bd8db8b8f9257ce8080690650bd55e7a0812e8ecc62001a8a608d1f82f9daa92ef6ca36c5498d6094f01a327a3d8f126
|
7
|
+
data.tar.gz: baf25c455e64044e2b3849df250d1b9a594b278b83903f41703d04a6c2b0ac56d3ec9ef6aa7bcadb0a672b658bd1251f8169b9f90893ed925754b265954b856e
|
data/.travis.yml
CHANGED
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
|
-
*
|
417
|
-
* Send
|
418
|
-
* If you edit the gemspec/version etc, do
|
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
|
data/lib/resque-retry/version.rb
CHANGED
@@ -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
|
-
|
85
|
-
|
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.
|
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-
|
13
|
+
date: 2014-06-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: resque
|