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
|
module WIN32OLESpecs
|
||||||
def self.new_ole(name)
|
def self.new_ole(name)
|
||||||
retried = false
|
tries = 0
|
||||||
begin
|
begin
|
||||||
WIN32OLE.new(name)
|
WIN32OLE.new(name)
|
||||||
rescue WIN32OLERuntimeError => e
|
rescue WIN32OLERuntimeError => e
|
||||||
unless retried
|
if tries < 3
|
||||||
retried = true
|
tries += 1
|
||||||
|
$stderr.puts "WIN32OLESpecs#new_ole retry (#{tries}): #{e.class}: #{e.message}"
|
||||||
|
sleep(2 ** tries)
|
||||||
retry
|
retry
|
||||||
|
else
|
||||||
|
raise
|
||||||
end
|
end
|
||||||
raise e
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,20 +5,7 @@ platform_is :windows do
|
||||||
|
|
||||||
describe "WIN32OLE#ole_func_methods" do
|
describe "WIN32OLE#ole_func_methods" do
|
||||||
before :each do
|
before :each do
|
||||||
# This part is unstable, so retrying 3 times.
|
@ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
after :each do
|
after :each do
|
||||||
|
|
|
@ -5,20 +5,7 @@ platform_is :windows do
|
||||||
|
|
||||||
describe :win32ole_ole_method, shared: true do
|
describe :win32ole_ole_method, shared: true do
|
||||||
before :each do
|
before :each do
|
||||||
# This part is unstable, so retrying 3 times.
|
@ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
after :each do
|
after :each do
|
||||||
|
|
Loading…
Add table
Reference in a new issue