resque-retry-on-lock 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/resque/plugins/retry_on_lock.rb +1 -1
- data/test/retry_on_lock_test.rb +7 -6
- metadata +3 -3
data/test/retry_on_lock_test.rb
CHANGED
@@ -5,7 +5,7 @@ require 'resque/plugins/retry_on_lock'
|
|
5
5
|
|
6
6
|
$counter = 0
|
7
7
|
|
8
|
-
class
|
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(
|
33
|
-
worker = Resque::Worker.new(
|
32
|
+
(count = 3).times { Resque.enqueue(TestJob) }
|
33
|
+
worker = Resque::Worker.new(TestJob.instance_eval{@queue})
|
34
34
|
|
35
|
-
until (size = Resque.size(
|
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(
|
41
|
+
assert_equal (size - 1 ), Resque.size(TestJob.instance_eval{@queue}.to_s)
|
41
42
|
end
|
42
43
|
|
43
|
-
assert_equal count
|
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:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonathon Storer
|