Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

rails interrupt if tooo long

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
Comment

PREVIOUS NEXT
Code Example
Ruby :: render to string rails 
Ruby :: ruby execute code in string 
Ruby :: ruby find by multiple columns 
Ruby :: is identation madatory in ruby 
Ruby :: generate float array in ruby 
Ruby :: rotate array by k times in rails 
Ruby :: how to know current schema database in rails 
Ruby :: ruby rails update email skip confirm email 
Ruby :: set db environment to development 
Ruby :: ruby classes 
Ruby :: capybara click with offset 
Ruby :: ruby plus plus 
Ruby :: ruby puts format 
Ruby :: ActionView::Template::Error (The asset "application.css" is not present in the asset pipeline. 
R :: r sort character number 
R :: remove line with na r 
R :: how to select all the records above a specific datetime in r 
R :: r convert matrix to list of column vectors 
R :: set row names in r 
R :: change from matrix to a dataframe in r 
R :: if not NA in r 
R :: show 2 ggplots together 
R :: R darekn color 
R :: read file in r EOF within quoted string 
R :: r function to get class of all columns 
R :: insert character into string r 
R :: logical vector passed in R 
R :: pairwise combinations r 
R :: change order of levels, reference 
R :: next element in a loop if error in r 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =