iudex-worker 1.3.0-java → 1.3.1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +4 -0
- data/init/iudex-worker +1 -1
- data/lib/iudex-worker/agent.rb +28 -25
- data/lib/iudex-worker/base.rb +1 -1
- data/test/test_agent.rb +13 -0
- metadata +2 -2
data/History.rdoc
CHANGED
data/init/iudex-worker
CHANGED
data/lib/iudex-worker/agent.rb
CHANGED
@@ -86,45 +86,48 @@ module Iudex
|
|
86
86
|
|
87
87
|
def run
|
88
88
|
Hooker.with( :iudex ) do
|
89
|
-
|
90
|
-
|
89
|
+
run_safe
|
90
|
+
end
|
91
|
+
end
|
91
92
|
|
92
|
-
|
93
|
-
|
94
|
-
|
93
|
+
def run_safe
|
94
|
+
dsf = PoolDataSourceFactory.new
|
95
|
+
data_source = dsf.create
|
95
96
|
|
96
|
-
|
97
|
+
wpoller = work_poller( data_source )
|
98
|
+
vexec = visit_manager( wpoller )
|
99
|
+
vexec.start_executor
|
97
100
|
|
98
|
-
|
99
|
-
fcf.http_client = hclient
|
100
|
-
fcf.data_source = data_source
|
101
|
-
fcf.visit_counter = vexec
|
101
|
+
hclient = http_client( vexec.executor )
|
102
102
|
|
103
|
-
|
104
|
-
|
105
|
-
|
103
|
+
fcf = filter_chain_factory
|
104
|
+
fcf.http_client = hclient
|
105
|
+
fcf.data_source = data_source
|
106
|
+
fcf.visit_counter = vexec
|
106
107
|
|
107
|
-
|
108
|
+
# FilterChain's executor is the same executor, unless using
|
109
|
+
# HTTPClient3, where executor is best not used
|
110
|
+
fcf.executor = vexec.executor unless @http_manager
|
108
111
|
|
109
|
-
|
110
|
-
vexec.filter_chain = chain
|
112
|
+
Hooker.apply( [ :iudex, :filter_factory ], fcf )
|
111
113
|
|
112
|
-
|
114
|
+
fcf.filter do |chain|
|
115
|
+
vexec.filter_chain = chain
|
113
116
|
|
114
|
-
|
115
|
-
vexec.join #Run until interrupted
|
116
|
-
end # fcf closes
|
117
|
+
Hooker.log_not_applied # All hooks should be used by now
|
117
118
|
|
118
|
-
|
119
|
-
|
119
|
+
vexec.start
|
120
|
+
vexec.join # Run until interrupted
|
121
|
+
end # fcf closes
|
120
122
|
|
121
|
-
dsf.close
|
122
|
-
end
|
123
123
|
rescue => e
|
124
124
|
@log.error( "On run: ", e )
|
125
|
+
ensure
|
126
|
+
hclient.close if hclient && hclient.respond_to?( :close )
|
127
|
+
@http_manager.shutdown if @http_manager
|
128
|
+
dsf.close if dsf
|
125
129
|
end
|
126
130
|
|
127
131
|
end
|
128
|
-
|
129
132
|
end
|
130
133
|
end
|
data/lib/iudex-worker/base.rb
CHANGED
data/test/test_agent.rb
CHANGED
@@ -69,6 +69,19 @@ class TestAgent < MiniTest::Unit::TestCase
|
|
69
69
|
Iudex.send( :remove_const, :AsyncHTTPClient )
|
70
70
|
end
|
71
71
|
|
72
|
+
def test_agent_graceful_shutdown_on_fcf_error
|
73
|
+
Hooker.add( [ :iudex, :filter_factory ] ) do |fcf|
|
74
|
+
def fcf.filters
|
75
|
+
super
|
76
|
+
raise "Test Badness in FCF"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
agent = Agent.new
|
81
|
+
agent.run
|
82
|
+
pass # returns
|
83
|
+
end
|
84
|
+
|
72
85
|
def assert_agent
|
73
86
|
|
74
87
|
# Stub VisitManager.start to allow agent.run to return early.
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: iudex-worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.3.
|
5
|
+
version: 1.3.1
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- David Kellum
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iudex-core
|