Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't handle http failures in eachRangeTopicPostsXML

  • Loading branch information...
commit 1d6ec73dab21e78d6e4a093b639e9c5005b534cc 1 parent 41de41d
Riccardo Cambiassi authored
Showing with 4 additions and 14 deletions.
  1. +4 −14 lib/radian6/api.rb
View
18 lib/radian6/api.rb
@@ -1,6 +1,7 @@
require 'rubygems'
require 'nokogiri'
require 'net/http'
+require 'em-http-request'
require 'uri'
require 'digest/md5'
require 'time'
@@ -88,21 +89,10 @@ def eachRangeTopicPostsXML(range_start, range_end, topics=[62727], media=[1,2,4,
counter = get_posts_counter_for(xml)
total_count = counter.total
fetched_article_count = (page -1) * page_size + counter.count
- yield page, xml, counter, nil
+
+ yield page, xml, counter
page += 1
- botched = 0
- rescue => e
- # TODO: rescue exceptions from malformed xml
- # raise if botched > 5
- # else log offending request and try again
- botched += 1
- if botched < 5
- # do nothing
- else
- yield page, xml, counter, e
- end
- raise counter.error if counter.error
end while total_count > fetched_article_count
end
@@ -167,7 +157,7 @@ def get_async(method, headers={})
headers['auth_token'] = @auth_token
end
http = EventMachine::HttpRequest.new(@endpoint + method, options ).get :head => headers
- http.response
+ http.response
end
def get_sync(method, args={})
Please sign in to comment.
Something went wrong with that request. Please try again.