Skip to content

Commit

Permalink
Do the simplest and dumbest things to make the tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Fayti1703 committed Oct 7, 2024
1 parent b98297c commit 85be57e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/mini_racer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/mini_racer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 85be57e

Please sign in to comment.