1
Ruby 오류 처리에 관해서는 거의 질문이 없습니다. 마지막 두 라인은 참조와Ruby open-uri RuntimeError - 금지 된 리다이렉션
/usr/lib/ruby/1.8/open-uri.rb:174:in `open_loop': redirection forbidden: // url goes here
from my_file.rb in 'join'
from my_file.rb in 'each'
:이 내가 가끔 다음과 같은 오류를 생산, 리디렉션 URL을 건너 실행할 때, 그러나
urls.each do |url|
begin
threads << Thread.new(url) do |url|
page = open(url)
# some further processing of page
end
rescue
puts "Could not retrieve url"
end
threads.each { |thread| thread.join }
: 나는 대략 다음과 같은 몇 가지 코드를 threads.each 블록을 포함하는 코드 행.
저는 왜 제가이 구조 오류가 시작된 이유를 궁금해하고 있었습니까? 여기에 누락 된 미묘한 것이 있습니까, 아마도 멀티 스레딩과 관련이 있을까요?