Skip to content

Commit

Permalink
[ruby/win32ole] Scale timeout in win32ole
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Nov 25, 2021
1 parent ae95939 commit 270c485
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/win32ole/test_win32ole_event.rb
Expand Up @@ -65,12 +65,13 @@ def message_loop(watch_ivar = nil)
if watch_ivar
# wait until event is proceeded
tries = 0
seconds = EnvUtil.apply_timeout_scale(1)
while tries < 5 && instance_variable_get(watch_ivar) == orig_ivar
seconds = 2 ** tries # sleep at most 31s in total
$stderr.puts "test_win32ole_event.rb: retrying and sleeping #{seconds}s until #{watch_ivar} is changed from #{orig_ivar.inspect}..."
WIN32OLE_EVENT.message_loop
sleep(seconds)
tries += 1
seconds *= 2 # sleep at most 31s in total
end
end
end
Expand Down

0 comments on commit 270c485

Please sign in to comment.