resque-retry-on-lock 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,7 +50,7 @@ module Resque
50
50
  end
51
51
 
52
52
  # Where the magic happens.
53
- def around_perform_lock(*args)
53
+ def around_perform_lock_and_requeue(*args)
54
54
  # Re-Enqueue if another job has created a lock.
55
55
  if Resque.redis.setnx(lock(*args), true)
56
56
  begin
@@ -5,7 +5,7 @@ require 'resque/plugins/retry_on_lock'
5
5
 
6
6
  $counter = 0
7
7
 
8
- class Job
8
+ class TestJob
9
9
  extend Resque::Plugins::RetryOnLock
10
10
  @queue = :test
11
11
 
@@ -29,18 +29,19 @@ class LockTest < Test::Unit::TestCase
29
29
  end
30
30
 
31
31
  def test_lock
32
- (count = 3).times { Resque.enqueue(Job) }
33
- worker = Resque::Worker.new(Job.instance_eval{@queue})
32
+ (count = 3).times { Resque.enqueue(TestJob) }
33
+ worker = Resque::Worker.new(TestJob.instance_eval{@queue})
34
34
 
35
- until (size = Resque.size(Job.instance_eval{@queue}.to_s)).zero? do
35
+ until (size = Resque.size(TestJob.instance_eval{@queue}.to_s)).zero? do
36
36
  workers = []
37
37
  size.times { workers << Thread.new { worker.process } }
38
38
  workers.each { |t| t.join }
39
+
39
40
  assert_equal (count - size + 1), $counter
40
- assert_equal (size - 1), Resque.size(Job.instance_eval{@queue}.to_s)
41
+ assert_equal (size - 1 ), Resque.size(TestJob.instance_eval{@queue}.to_s)
41
42
  end
42
43
 
43
- assert_equal count,$counter
44
+ assert_equal count, $counter
44
45
 
45
46
  end
46
47
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-retry-on-lock
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathon Storer