I have this piece of code:
begin complete_results = Timeout.timeout(4) do results = platform.search(artist, album_name) end rescue Timeout::Error
Your code is correct
require 'timeout' begin complete_results = Timeout.timeout(1) do sleep(2) end rescue Timeout::Error puts 'Print me something please' end
does print out "print me something please".
Try the basic code as above. If that works, you have an issue in platform.search.
platform.search