jeudi 20 avril 2017

How begin rescue works with timeout?

Example

begin
  Timeout::timeout(5) do
    #some code
  end
  #other codes
  #other codes
rescue Timeout::Error
  Rails.logger.debug {" Command took longer than expected"}
end

When the #some codetakes longer then 5 sec will it run #other codes? I was guessing it will not run the #other codes. It will directly jump to rescue block. Correct me if i m wrong.

Aucun commentaire:

Enregistrer un commentaire