resque_stuck_queue 0.0.6 → 0.0.7
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
|
-
SHA1:
|
3
|
-
data.tar.gz: f3bb5b9529929905d39cbe224c3be24be7a140a3
|
4
|
-
metadata.gz: 22cdb53ee5c30b9ba2fac0e44a029e9163980cc6
|
5
2
|
SHA512:
|
6
|
-
|
7
|
-
|
3
|
+
metadata.gz: 9a0277c13278dc4044d3da46038e8abf0a1cb44d43ec4acc858e8b2c17519f215468f627a2025e7a680a3d97dc28938314babaf2ac4dc62170afaef0248e63b6
|
4
|
+
data.tar.gz: b7864ee5d7d1e3e185f87f6dd016725016e8595b82c78d9d69a90a7eaf02b3b7a366002859a0c7b1f2d030ebdd5b0d4a4b7adbe7757efe950ff970f1ee48d750
|
5
|
+
SHA1:
|
6
|
+
metadata.gz: 65ce8ea2275ca9e9da2e22178e496b66bcdcc593
|
7
|
+
data.tar.gz: c552ea4b8ae68c03387a62fe83e98b3f8545fcf1
|
data/test/test_collision.rb
CHANGED
@@ -4,6 +4,10 @@ class TestCollision < Minitest::Test
|
|
4
4
|
|
5
5
|
include TestHelper
|
6
6
|
|
7
|
+
def setup
|
8
|
+
Resque.redis.flushall
|
9
|
+
end
|
10
|
+
|
7
11
|
def test_two_processes_interacting
|
8
12
|
puts "#{__method__}"
|
9
13
|
# no resque should be running here so timeouts will be reached + trigger
|
@@ -15,7 +19,7 @@ class TestCollision < Minitest::Test
|
|
15
19
|
p4 = fork { Resque.redis.client.reconnect; run_resque_stuck_daemon; }
|
16
20
|
|
17
21
|
Thread.new {
|
18
|
-
sleep
|
22
|
+
sleep 5 # let test run and trigger once occur (according to time below)
|
19
23
|
`kill -9 #{p1}`
|
20
24
|
`kill -9 #{p2}`
|
21
25
|
`kill -9 #{p3}`
|
data/test/test_integration.rb
CHANGED
@@ -78,5 +78,24 @@ class TestIntegration < Minitest::Test
|
|
78
78
|
Process.kill("SIGCONT", @resque_pid)
|
79
79
|
end
|
80
80
|
|
81
|
+
def test_has_settable_custom_hearbeat_job
|
82
|
+
puts "#{__method__}"
|
83
|
+
Resque::StuckQueue.config[:trigger_timeout] = 2 # won't allow waiting too much and will complain (eg trigger) sooner than later
|
84
|
+
Resque::StuckQueue.config[:heartbeat] = 1
|
85
|
+
|
86
|
+
begin
|
87
|
+
Resque::StuckQueue.config[:refresh_job] = proc { Resque.enqueue(RefreshLatestTimestamp, Resque::StuckQueue.global_key) }
|
88
|
+
@triggered = false
|
89
|
+
Resque::StuckQueue.config[:handler] = proc { @triggered = true }
|
90
|
+
Thread.new { Resque::StuckQueue.start }
|
91
|
+
|
92
|
+
@resque_pid = run_resque
|
93
|
+
sleep 3 # allow trigger
|
94
|
+
assert true, "should not have raised"
|
95
|
+
assert @triggered, "should have triggered"
|
96
|
+
rescue => e
|
97
|
+
assert false, "should have succeeded with good refresh_job.\n #{e.inspect}"
|
98
|
+
end
|
99
|
+
end
|
81
100
|
|
82
101
|
end
|
@@ -8,10 +8,13 @@ class TestYourOwnRefreshJob < Minitest::Test
|
|
8
8
|
Resque::StuckQueue.config[:trigger_timeout] = 1
|
9
9
|
Resque::StuckQueue.config[:heartbeat] = 1
|
10
10
|
Resque::StuckQueue.config[:abort_on_exception] = true
|
11
|
+
Resque::StuckQueue.config[:refresh_job] = nil
|
12
|
+
Resque.redis.flushall
|
11
13
|
end
|
12
14
|
|
13
15
|
def teardown
|
14
16
|
Resque::StuckQueue.reset!
|
17
|
+
Resque::StuckQueue.config.clear
|
15
18
|
end
|
16
19
|
|
17
20
|
def test_will_trigger_with_unrefreshing_custom_heartbeat_job
|
@@ -38,19 +41,4 @@ class TestYourOwnRefreshJob < Minitest::Test
|
|
38
41
|
end
|
39
42
|
|
40
43
|
|
41
|
-
def test_has_settable_custom_hearbeat_job
|
42
|
-
puts "#{__method__}"
|
43
|
-
begin
|
44
|
-
Resque::StuckQueue.config[:refresh_job] = proc { Resque.enqueue(RefreshLatestTimestamp, Resque::StuckQueue.global_key) }
|
45
|
-
@triggered = false
|
46
|
-
Resque::StuckQueue.config[:handler] = proc { @triggered = true }
|
47
|
-
start_and_stop_loops_after(3)
|
48
|
-
assert true, "should not have raised"
|
49
|
-
assert @triggered, "should have triggered"
|
50
|
-
rescue => e
|
51
|
-
assert false, "should have succeeded with good refresh_job.\n #{e.inspect}"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque_stuck_queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shai Rosenfeld
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-14 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis-mutex
|
@@ -68,7 +68,7 @@ files:
|
|
68
68
|
- test/test_integration.rb
|
69
69
|
- test/test_logger.rb
|
70
70
|
- test/test_resque_stuck_queue.rb
|
71
|
-
- test/
|
71
|
+
- test/test_set_custom_refresh_job.rb
|
72
72
|
homepage: https://github.com/shaiguitar/resque_stuck_queue/
|
73
73
|
licenses:
|
74
74
|
- MIT
|
@@ -100,4 +100,4 @@ test_files:
|
|
100
100
|
- test/test_integration.rb
|
101
101
|
- test/test_logger.rb
|
102
102
|
- test/test_resque_stuck_queue.rb
|
103
|
-
- test/
|
103
|
+
- test/test_set_custom_refresh_job.rb
|