mjfreshyfresh-mini_fb 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/mini_fb.rb +12 -5
  2. metadata +1 -1
data/lib/mini_fb.rb CHANGED
@@ -7,6 +7,8 @@ module MiniFB
7
7
  # Global constants
8
8
  FB_URL = "http://api.facebook.com/restserver.php"
9
9
  FB_API_VERSION = "1.0"
10
+
11
+ RETRY_ATTEMPTS = 10
10
12
 
11
13
  @@logging = false
12
14
 
@@ -159,16 +161,21 @@ module MiniFB
159
161
  kwargs["sig"] = Digest::MD5.hexdigest( arg_string + secret.value.call )
160
162
 
161
163
  # Call website with POST request
162
- attempt = 0
164
+ attempt = 0
163
165
  begin
164
166
  response = Net::HTTP.post_form( URI.parse(FB_URL), kwargs )
165
- rescue SocketError, Errno::ECONNRESET => err
166
- attempt += 1
167
- retry if attempt == 1
167
+ rescue SocketError, Errno::ECONNRESET, EOFError => err
168
+ if attempt < RETRY_ATTEMPTS
169
+ attempt += 1
170
+ retry
171
+ else
172
+ raise
173
+ end
168
174
  # raise IOError.new( "Cannot connect to the facebook server: " + err )
175
+ rescue
169
176
  raise
170
177
  end
171
-
178
+
172
179
  # Handle response
173
180
  return response.body if custom_format
174
181
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mjfreshyfresh-mini_fb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder