@@ -9,7 +9,7 @@ module Concurrent
99
1010 after ( :each ) do
1111 subject . shutdown
12- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
12+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
1313 end
1414
1515 it_should_behave_like :thread_pool
@@ -56,21 +56,21 @@ module Concurrent
5656 subject = described_class . new ( 5 , :max_queue => 10 )
5757 expect ( subject . max_queue ) . to eq 10
5858 subject . shutdown
59- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
59+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
6060 end
6161
6262 it 'correctly sets valid :fallback_policy' do
6363 subject = described_class . new ( 5 , :fallback_policy => :caller_runs )
6464 expect ( subject . fallback_policy ) . to eq :caller_runs
6565 subject . shutdown
66- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
66+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
6767 end
6868
6969 it "correctly sets valid :idletime" do
7070 subject = described_class . new ( 5 , :idletime => 10 )
7171 expect ( subject . idletime ) . to eq 10
7272 subject . shutdown
73- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
73+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
7474 end
7575
7676 it 'raises an exception if given an invalid :fallback_policy' do
@@ -98,7 +98,7 @@ module Concurrent
9898 subject . post { latch . count_down }
9999 latch . wait ( 0.1 )
100100 subject . shutdown
101- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
101+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
102102 expect ( subject . min_length ) . to eq num_threads
103103 end
104104 end
@@ -121,7 +121,7 @@ module Concurrent
121121 subject . post { latch . count_down }
122122 latch . wait ( 0.1 )
123123 subject . shutdown
124- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
124+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
125125 expect ( subject . max_length ) . to eq num_threads
126126 end
127127 end
@@ -154,7 +154,7 @@ module Concurrent
154154 subject . post { latch . count_down }
155155 latch . wait ( 0.1 )
156156 subject . shutdown
157- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
157+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
158158 expect ( subject . largest_length ) . to eq num_threads
159159 end
160160 end
@@ -186,7 +186,7 @@ module Concurrent
186186 expect ( pool . length ) . to eq 5
187187 latch . count_down
188188 pool . shutdown
189- expect ( pool . wait_for_termination ( 1 ) ) . to eq true
189+ expect ( pool . wait_for_termination ( pool_termination_timeout ) ) . to eq true
190190 end
191191 end
192192
@@ -217,7 +217,7 @@ module Concurrent
217217 latch . wait ( 1 )
218218 } . to raise_error ( RejectedExecutionError )
219219 subject . shutdown
220- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
220+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
221221 end
222222
223223 # On discard, we'd expect no error, but also not all five results
@@ -237,7 +237,7 @@ module Concurrent
237237
238238 expect ( @queue . length ) . to be < 5
239239 subject . shutdown
240- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
240+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
241241 end
242242
243243 # To check for caller_runs, we'll check how many unique threads
@@ -267,7 +267,7 @@ module Concurrent
267267 expect ( a . uniq . size ) . to be_within ( 1 ) . of ( 3 ) # one for each of the two threads, plus the caller
268268
269269 subject . shutdown
270- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
270+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
271271 end
272272 end
273273
@@ -283,7 +283,7 @@ module Concurrent
283283 subject = FixedThreadPool . new ( 5 , fallback_policy : :discard )
284284 expect ( subject . fallback_policy ) . to eq :discard
285285 subject . shutdown
286- expect ( subject . wait_for_termination ( 1 ) ) . to eq true
286+ expect ( subject . wait_for_termination ( pool_termination_timeout ) ) . to eq true
287287 end
288288
289289 else
@@ -307,7 +307,7 @@ module Concurrent
307307 sleep ( 0.1 )
308308 expect ( pool . length ) . to eq 5
309309 pool . shutdown
310- expect ( pool . wait_for_termination ( 1 ) ) . to eq true
310+ expect ( pool . wait_for_termination ( pool_termination_timeout ) ) . to eq true
311311 end
312312 end
313313 end
0 commit comments