resque-retry 1.8.0 → 1.8.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
  SHA256:
3
- metadata.gz: e59965fb9d40a6d3f680291e5cbdec8edf04946ad50749175e984062a52e9d1c
4
- data.tar.gz: c7962de9928657b3b4b2745efbb5e403a512f44a1b0cd5db5701aee87302dffa
3
+ metadata.gz: 562c945b75ddfc1a5136f6966bae9e9cce9b79167ec63c84c68a64d4ee0f9cad
4
+ data.tar.gz: 8e8069a54b444dd02b8c14ed8bd327a5bde8d33bde64529f3a0de570bcc7a938
5
5
  SHA512:
6
- metadata.gz: 41c214710cdfb36737e8ed9cc598f625df4020e29a056f235fd8aa636cec7f2e220f63afbfa29090b944444cee0f938b66d676b23496671b65f7f1051f08b8e4
7
- data.tar.gz: c78705b7a1a87c9b92c8eb6c9b72070dfb51f52dcab7b3cdc55e2a0a89940f34a1ef98255f11986a43011c6a56abeeee0d2f96493b41ee921ad90dab178ce76b
6
+ metadata.gz: ded662e20a75af089bf98d09b37b95ac3c5b81f4cb0e8f0d2241c5207007d738382baff53682284c1ba157fa50d44648a5e54325d0492418b065a81683dd7cbb
7
+ data.tar.gz: 6290a973a9576501f8654189ddad0da8df77711c0b3e3aafbfd581faf4de2aef15b1f15eaa0f6f3b43fcf368cd8a0e49ad099fa48b426be84c67e02c17828f0f
@@ -49,12 +49,21 @@ module ResqueRetry
49
49
 
50
50
  # gets the number of retry attempts for a job.
51
51
  def retry_attempts_for_job(job)
52
- Resque.redis.get(retry_key_for_job(job))
52
+ retry_key = retry_key_for_job(job)
53
+ if retry_key
54
+ Resque.redis.get(retry_key)
55
+ else
56
+ nil
57
+ end
53
58
  end
54
59
 
55
60
  # gets the failure details hash for a job.
56
61
  def retry_failure_details(retry_key)
57
- Resque.decode(Resque.redis.get("failure-#{retry_key}"))
62
+ if retry_key
63
+ Resque.decode(Resque.redis.get("failure-#{retry_key}"))
64
+ else
65
+ nil
66
+ end
58
67
  end
59
68
 
60
69
  # reads a 'local' template file.
@@ -1,3 +1,3 @@
1
1
  module ResqueRetry
2
- VERSION = '1.8.0'
2
+ VERSION = '1.8.1'
3
3
  end
@@ -19,4 +19,17 @@ class ServerHelpersTest < Minitest::Test
19
19
  job = Resque.delayed_timestamp_peek(timestamp, 0, 1).first
20
20
  assert_equal '0', @helpers.retry_attempts_for_job(job), 'should have 0 retry attempt'
21
21
  end
22
+
23
+ def test_retry_key_for_job_empty
24
+ Resque.enqueue(DelayedJobNoRetryKey)
25
+ perform_next_job(@worker)
26
+
27
+ timestamp = Resque.delayed_queue_peek(0, 1).first
28
+ job = Resque.delayed_timestamp_peek(timestamp, 0, 1).first
29
+ retry_key = @helpers.retry_key_for_job(job)
30
+
31
+ assert_nil retry_key, 'should be nil as the class does not respond to redis_retry_key'
32
+ assert_nil @helpers.retry_attempts_for_job(job), 'should have nil retry attempts as the key does not exist'
33
+ assert_nil @helpers.retry_failure_details(retry_key), 'should have nil failure details as the key does not exist'
34
+ end
22
35
  end
data/test/test_jobs.rb CHANGED
@@ -198,6 +198,10 @@ class LimitThreeJobDelay1Hour < LimitThreeJob
198
198
  @retry_delay = 3600
199
199
  end
200
200
 
201
+ class DelayedJobNoRetryKey
202
+ @queue = :testing
203
+ end
204
+
201
205
  class FailFiveTimesJob < RetryDefaultsJob
202
206
  @queue = :testing
203
207
  @retry_limit = 6
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.8.0
4
+ version: 1.8.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: 2023-04-15 00:00:00.000000000 Z
13
+ date: 2023-06-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: resque
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  - !ruby/object:Gem::Version
230
230
  version: '0'
231
231
  requirements: []
232
- rubygems_version: 3.3.7
232
+ rubygems_version: 3.4.14
233
233
  signing_key:
234
234
  specification_version: 4
235
235
  summary: A resque plugin; provides retry, delay and exponential backoff support for