summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2015-01-13 11:13:48 -0500
committerMicah Anderson <micah@riseup.net>2015-01-13 11:13:48 -0500
commit0fbe82d154d5dc7e4e56251bfdaf3b06563ee3e6 (patch)
tree7cc28236abeda26ffabd6940ce16325aecfbab81
parent4c0d5673df02fe42e1bbadfee7d4ea1ca1f88e98 (diff)
Also retry and wait if the response code is 422 (#6571)
-rw-r--r--files/couch-doc-update6
1 files changed, 4 insertions, 2 deletions
diff --git a/files/couch-doc-update b/files/couch-doc-update
index 903a661..bc23fd9 100644
--- a/files/couch-doc-update
+++ b/files/couch-doc-update
@@ -121,7 +121,8 @@ def update_document(db, doc, data)
doc.merge! data
db.save_doc(doc)
rescue RestClient::Exception => e
- if e.response.code == 500
+ case e.response.code
+ when 500, 422 then
raise if attempt > 5
attempt += 1
sleep 10
@@ -134,7 +135,8 @@ def create_document(db, doc_id, data)
data["_id"] = doc_id
db.save_doc(data)
rescue RestClient::Exception => e
- if e.response.code == 500
+ case e.response.code
+ when 500, 422 then
raise if attempt > 5
attempt += 1
sleep 10