diff --git a/lib/mini_racer.rb b/lib/mini_racer.rb index 248181e..400012b 100644 --- a/lib/mini_racer.rb +++ b/lib/mini_racer.rb @@ -360,7 +360,7 @@ def timeout(&blk) t = Thread.new do begin while true do - result = IO.select([rp],[],[],0.1) # seconds # TODO: Adjust this interval depending on the remaining wall/cpu clock; required for tests + result = IO.select([rp],[],[],0.05) # seconds # TODO: Adjust this interval depending on the remaining wall/cpu clock; required for tests break if result # operation completed current_monotonic_time = Process.clock_gettime Process::CLOCK_MONOTONIC, :millisecond if thread_clock then diff --git a/test/mini_racer_test.rb b/test/mini_racer_test.rb index f7d98a3..fa07b5e 100644 --- a/test/mini_racer_test.rb +++ b/test/mini_racer_test.rb @@ -119,7 +119,7 @@ def test_it_can_time_out_js_eval def test_it_can_hit_cputime_limit_during_serialization context = MiniRacer::Context.new(timeout: 30,cputime_limit: 20) - Timeout::timeout(0.025) do + Timeout::timeout(0.250) do assert_raises(MiniRacer::ScriptTerminatedError) do context.eval 'var a = {get a(){ while(true); }}; a' end @@ -129,7 +129,7 @@ def test_it_can_hit_cputime_limit_during_serialization def test_it_can_limit_cputime context = MiniRacer::Context.new(timeout: 20, cputime_limit: 2) # our test should raise after the cputime_limit, but before our timeout - Timeout::timeout(0.010) do + Timeout::timeout(0.100) do assert_raises do context.eval('while(true){}') end