Open mohamedhafez opened 3 years ago
Using Timeout::timeout is inherently unsafe (see https://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/ and http://blog.headius.com/2008/02/ruby-threadraise-threadkill-timeoutrb.html), and also inefficient because it spins up a new thread on each invocation.
A better solution would be to switch to all the socket timeout options now available, or to use nonblocking io and IO.select
IO.select
Using Timeout::timeout is inherently unsafe (see https://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/ and http://blog.headius.com/2008/02/ruby-threadraise-threadkill-timeoutrb.html), and also inefficient because it spins up a new thread on each invocation.
A better solution would be to switch to all the socket timeout options now available, or to use nonblocking io and
IO.select