cloudant/CDTDatastore — pull request #31 by mikerhodes (2014-05-27 16:50:46+00:00)
Title: 31142 Retry sending revisions if we get a 412 missing_stub response for a document

This PR makes two contributions:

- A mechanism for TDPusher to put revisions back into queue for processing if a recoverable error happens.
- If TDPusher receives a 412 during `_bulk_docs` uploads, retry the upload later. A 412 indicates something wrong with the stubs we're sending or in existence at the remote end, so we fall back to the "safe" way of sending multipart/related along with all attachment content. This matches CouchDB 1.5's behaviour.

TDPusher can also send multipart/related payloads for documents with "large" attachments. These may include stubs, so I think I need to also fix up that code path to support 412 reponse codes. It's probably worth reviewing the PR while it's smaller, however.

@tomblench @gadamc Adding your names to notify you (are you automatically notified of my PRs anyway?)