Browse files

Handle Posterous rate limiting

  • Loading branch information...
1 parent 5d6e87b commit 0284b8b22f12081f7e35563592be41ae082c3cfe @simensen committed Jan 23, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/jekyll/migrators/posterous.rb
View
5 lib/jekyll/migrators/posterous.rb
@@ -29,6 +29,11 @@ def self.fetch(uri_str, limit = 10)
case response
when Net::HTTPSuccess then response
when Net::HTTPRedirection then fetch(response['location'], limit - 1)
+ when Net::HTTPForbidden then
+ retry_after = response.to_hash['retry-after'][0]
+ puts "We have been told to try again after #{retry_after} seconds"
+ sleep(retry_after.to_i + 1)
+ fetch(uri_str, limit - 1)
else response.error!
end
end

0 comments on commit 0284b8b

Please sign in to comment.