Problem with ruby ​​nested timeouts over system calls

I ran into this strange problem when working with ruby ​​timings (on rails). This time

timeout(10) do
 //some code involving http calls that takes more than 10 seconds
end

does not work. But this timeout

timeout(20) do
 timeout(10) do
   //some code involving http calls that takes more than 10 seconds
 end
end

expires in 20 seconds. I read that ruby ​​timeout does not work properly if it is associated with system calls. If so, then any number of nested timeouts should also not work. Why will this work in the second timeout?

By the way, the link I called http://ph7spot.com/musings/system-timer

Thanks in advance

+3
source share
1 answer

You may be able to use a combination timeoutand terminator to do such things.

timeout , , .

+1

Source: https://habr.com/ru/post/1795461/


All Articles