Rails interrumpe si es demasiado largo

require 'timeout'
timeout_in_seconds = 20
begin
  Timeout::timeout(timeout_in_seconds) do
    #Do something that takes long time
  end
rescue Timeout::Error
  # Too slow!!
end
Lioruby