onyx-resque-retry 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -179,13 +179,19 @@ module Resque
179
179
 
180
180
  # Will retry the job.
181
181
  def try_again(*args)
182
- @retry_job_class ||= self
182
+ retry_in_queue = @retry_job_class ? @retry_job_class : self
183
183
  if retry_delay <= 0
184
184
  # If the delay is 0, no point passing it through the scheduler
185
- Resque.enqueue(@retry_job_class, *args_for_retry(*args))
185
+ Resque.enqueue(retry_in_queue, *args_for_retry(*args))
186
186
  else
187
- Resque.enqueue_in(retry_delay, @retry_job_class, *args_for_retry(*args))
187
+ Resque.enqueue_in(retry_delay, retry_in_queue, *args_for_retry(*args))
188
188
  end
189
+
190
+ clean_retry_key(args) if @retry_job_class
191
+ end
192
+
193
+ def clean_retry_key(*args)
194
+ Resque.redis.del(redis_retry_key(*args))
189
195
  end
190
196
 
191
197
  # Resque before_perform hook.
data/test/retry_test.rb CHANGED
@@ -123,9 +123,10 @@ class RetryTest < Test::Unit::TestCase
123
123
 
124
124
  assert job_from_retry_queue = Resque.pop(:testing_retry)
125
125
  assert_equal ['arg1'], job_from_retry_queue['args']
126
+ assert_equal nil, Resque.redis.get(JobWithRetryQueue.redis_retry_key('arg1'))
126
127
  end
127
128
 
128
- def test_retry_failed_jobs_in_separate_queue
129
+ def test_retry_delayed_failed_jobs_in_separate_queue
129
130
  Resque.enqueue(DelayedJobWithRetryQueue, 'arg1')
130
131
  Resque.expects(:enqueue_in).with(1, JobRetryQueue, 'arg1')
131
132
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onyx-resque-retry
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Luke Antins