Ruby's Thread with timeout
bt = BetterThread.new timeout: 3 do
sleep 5
end
bt.join # joins after 3 seconds
bt.timeout? # true
Add this line to your application's Gemfile:
gem 'better_thread'
Bug reports and pull requests are welcome on GitHub at https://github.com/matti/better-thread
The gem is available as open source under the terms of the MIT License.