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
2424 subject { described_class . new ( idletime : 1 , max_threads : 2 , gc_interval : 0 ) }
2525
2626 it 'removes from pool any thread that has been idle too long' do
27- subject . instance_variable_set ( :@idletime , 1 )
2827 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 } }
3029 expect ( latch . wait ( 1 ) ) . to be true
3130
31+ subject . instance_variable_set ( :@idletime , 1 )
32+
33+ sleep 1.5
34+
3235 max_threads = subject . length
33- sleep ( 2 )
3436
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
3840
3941 expect ( subject . length ) . to be < max_threads
4042 end
You can’t perform that action at this time.
0 commit comments