mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
revert r65389 and r64993
and move retry logic to internal method git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cb9f2066b5
commit
090e2130d3
3 changed files with 9 additions and 32 deletions
|
@ -1,14 +1,17 @@
|
|||
module WIN32OLESpecs
|
||||
def self.new_ole(name)
|
||||
retried = false
|
||||
tries = 0
|
||||
begin
|
||||
WIN32OLE.new(name)
|
||||
rescue WIN32OLERuntimeError => e
|
||||
unless retried
|
||||
retried = true
|
||||
if tries < 3
|
||||
tries += 1
|
||||
$stderr.puts "WIN32OLESpecs#new_ole retry (#{tries}): #{e.class}: #{e.message}"
|
||||
sleep(2 ** tries)
|
||||
retry
|
||||
else
|
||||
raise
|
||||
end
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,20 +5,7 @@ platform_is :windows do
|
|||
|
||||
describe "WIN32OLE#ole_func_methods" do
|
||||
before :each do
|
||||
# This part is unstable, so retrying 3 times.
|
||||
tries = 0
|
||||
begin
|
||||
@ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
|
||||
rescue WIN32OLERuntimeError => e
|
||||
# WIN32OLERuntimeError: failed to create WIN32OLE object from `InternetExplorer.Application'
|
||||
# HRESULT error code:0x800704a6
|
||||
# A system shutdown has already been scheduled.
|
||||
if tries < 3
|
||||
tries += 1
|
||||
$stderr.puts "WIN32OLE#ole_func_methods retry (#{tries}): #{e.class}: #{e.message}"
|
||||
retry
|
||||
end
|
||||
end
|
||||
@ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
|
||||
end
|
||||
|
||||
after :each do
|
||||
|
|
|
@ -5,20 +5,7 @@ platform_is :windows do
|
|||
|
||||
describe :win32ole_ole_method, shared: true do
|
||||
before :each do
|
||||
# This part is unstable, so retrying 3 times.
|
||||
tries = 0
|
||||
begin
|
||||
@ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
|
||||
rescue WIN32OLERuntimeError => e
|
||||
# WIN32OLERuntimeError: failed to create WIN32OLE object from `InternetExplorer.Application'
|
||||
# HRESULT error code:0x800704a6
|
||||
# A system shutdown has already been scheduled.
|
||||
if tries < 3
|
||||
tries += 1
|
||||
$stderr.puts "win32ole_ole_method retry (#{tries}): #{e.class}: #{e.message}"
|
||||
retry
|
||||
end
|
||||
end
|
||||
@ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
|
||||
end
|
||||
|
||||
after :each do
|
||||
|
|
Loading…
Add table
Reference in a new issue