File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -24,17 +24,19 @@ module Concurrent
24
24
subject { described_class . new ( idletime : 1 , max_threads : 2 , gc_interval : 0 ) }
25
25
26
26
it 'removes from pool any thread that has been idle too long' do
27
- subject . instance_variable_set ( :@idletime , 1 )
28
27
latch = Concurrent ::CountDownLatch . new ( 3 )
29
- 3 . times { subject << proc { sleep ( 0.1 ) ; latch . count_down } }
28
+ 4 . times { subject << proc { sleep 0.1 ; latch . count_down } }
30
29
expect ( latch . wait ( 1 ) ) . to be true
31
30
31
+ subject . instance_variable_set ( :@idletime , 1 )
32
+
33
+ sleep 1.5
34
+
32
35
max_threads = subject . length
33
- sleep ( 2 )
34
36
35
- latch = Concurrent :: CountDownLatch . new ( 1 )
36
- subject << proc { latch . count_down }
37
- expect ( latch . wait ( 1 ) ) . to be true
37
+ subject . send :prune_pool
38
+ sleep 0.1
39
+ subject . send :prune_pool
38
40
39
41
expect ( subject . length ) . to be < max_threads
40
42
end
You can’t perform that action at this time.
0 commit comments