mwmitchell/rsolr — pull request #49 by nz (2012-04-08 04:49:25+00:00)
Title: Ability to automatically retry a 503 response.

Sometimes Solr will throw a HTTP 503 (e.g. exceeded limit of maxWarmingSearchers), and at Websolr we also occasionally must throw a 503 for certain temporary network conditions.

Generally, a 503 is a temporary condition that can be retried. Here's the relevant bit of RFC:

> The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.

The HTTP spec may be a _little_ fuzzy on whether this is okay, but I propose that when RSolr receives a 503 with a `Retry-After` header, it automatically retries the request after the specified delay, if requested by the user.

So here's my implementation of that idea.

Thoughts? Is this appropriate?