Skip to content

Instantly share code, notes, and snippets.

@jasonlyles
Created November 24, 2009 21:17
Show Gist options
  • Save jasonlyles/242226 to your computer and use it in GitHub Desktop.
Save jasonlyles/242226 to your computer and use it in GitHub Desktop.
def run_pulse_run
@id = params[:id]
@timeout = params[:timeout]
result = ''
#Adding a timeout on my end in hopes of keeping this page from crashing the mongrel
begin
status = Timeout::timeout(@timeout.to_i) do
#And adding a rescue for Mongrel timeouts, just to be safe
begin
result = PulseRunner.run_pulse_test(@id,@timeout)
rescue Mongrel::TimeoutError
puts "Mongrel::TimeoutError!!"
#Do nothing! The if block below will take care of it
end
end
rescue Timeout::Error => te
puts "Timeout:Error! (Not a mongrel timeout error)"
#Do nothing! The if block below will take care of it
end
if result != ''
@display = result
else
@display = "Unavailable"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment