begin Timeout::timeout(5) { @db.query(select * from books") } rescue Timeout::Error puts "Too slow, forget about it." end
For instance, In above statment, @db.query will take 10 seconds to complete.
But,
I would like to kill that query after 5 seconds.
how to kill the running @db.query in rescue statment.? With in 5 seconds whatever records fetched from db, How can i get those results?
Any ideas??..