zachfeldman/rubypress — pull request #13 by pseudomuto (2014-03-13 16:49:57+00:00)
Title: retrying requests that time out

@zachfeldman for review

# Problem

Time outs can happen for all kinds of reasons. On occasion this happens with shared hosting sites that need to "wake up" your application before serving requests. When this happens, the solution is to simply make the call again.

Writing this retry code everywhere kinda sucks...

# Solution

Wrap `XMLRPC::Client#call` in a _retryable_ block. I've done this by using the equivalent to `alias_method_chain` so that the retry is completely transparent to calling code (no changes required).

Now all calls to `#connection.call` in `Rubypress::Client` will be retried if a `Timeout::Error` or `Net::ReadTimeout` occurs.