resque-workers-lock 1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/resque/plugins/workers/lock.rb +9 -0
- data/test/lock_test.rb +6 -0
- metadata +1 -1
@@ -1,4 +1,13 @@
|
|
1
1
|
module Resque
|
2
|
+
alias_method :orig_remove_queue, :remove_queue
|
3
|
+
|
4
|
+
def remove_queue(queue)
|
5
|
+
Resque.redis.keys('enqueuelock:*').collect { |x| Resque.redis.del(x) }.count
|
6
|
+
Resque.redis.keys('workerslock:*').collect { |x| Resque.redis.del(x) }.count
|
7
|
+
|
8
|
+
orig_remove_queue(queue)
|
9
|
+
end
|
10
|
+
|
2
11
|
module Plugins
|
3
12
|
module Workers
|
4
13
|
module Lock
|
data/test/lock_test.rb
CHANGED
@@ -64,6 +64,12 @@ class LockTest < Test::Unit::TestCase
|
|
64
64
|
end
|
65
65
|
|
66
66
|
assert_equal 4, Resque.redis.llen('queue:lock_test')
|
67
|
+
|
68
|
+
# Test for complete queue wipe
|
69
|
+
Resque.remove_queue(:lock_test)
|
70
|
+
|
71
|
+
Resque.enqueue(SimilarJob)
|
72
|
+
assert_equal 1, Resque.redis.llen('queue:lock_test')
|
67
73
|
end
|
68
74
|
|
69
75
|
def test_zcleanup
|