uniqUsers = User.find(params[:userid]).events.where("comingfrom != ''").uniq_by {|obj| obj.comingfrom}
uniqUsers.map do |elem|
begin
@tag = nil
open('http://localhost:3000/search_dbs/show?userid='+ params[:userid] + '&fromnumber=' + elem.comingfrom + '&format=json', 'r', :read_timeout=>1) do |http|
@tag = http.read
end
rescue Exception => e
puts "failes"
puts e
end
end
嗨,这让我发疯了,由于某种原因,open url 命令超时而没有错误。当我在 chrome 中尝试相同的 url 时,一切都像魅力一样,当我从代码中执行此操作时,我得到 Timeout::Error