jeudi 5 mai 2022

Ruby Timeout.timeout does not timeout in x secs

Below code

Timeout.timeout(2) do
  i = 0
  while(true)
    i = i + 1
    p "test #{i}"
  end
end

does not timeout in 2 secs. whereas below similar code timeout in 2 seconds

Timeout.timeout(2) do
  i = 0
  while(true)
    i = i + 1
    # p "test #{i}"
  end
end

What is the underlying difference? Please help.

Aucun commentaire:

Enregistrer un commentaire