Created
December 19, 2016 21:27
-
-
Save AlexandrBasan/e0a21ee432db739a8edca879b8dcfe4d to your computer and use it in GitHub Desktop.
Rails Timeout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'timeout' | |
begin | |
complete_results = Timeout.timeout(1) do | |
sleep(2) | |
end | |
rescue Timeout::Error | |
puts 'Print me something please' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment