lib/http_crawler/client.rb in http_crawler-0.3.1.27 vs lib/http_crawler/client.rb in http_crawler-0.3.1.28

- old
+ new

@@ -59,11 +59,11 @@ end attr_accessor :max_error_num # 最大错误重试次数 def max_error_num - @max_error_num ||= 1 + @max_error_num ||= 3 end attr_reader :uri # init_uri 如果未初始化@uri,则会报错 # 继承类需要实现 @uri = URI("http://host") @@ -332,16 +332,10 @@ # 错误尝试次数小于等于0就结束尝试 raise error else # 每次错误次数尝试 -1 n -= 1 - case error - when HTTP::TimeoutError - # 超时错误切换代理 - raise error unless self.update_proxy? - else - raise error unless self.update_proxy? - end + self.update_proxy? retry end end end # def request(&block) end