Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added storeRetryUpdate.

  • Loading branch information...
commit 2f7f4b860b853a6aa515a93200bfea45b582c74d 1 parent 16ca699
@elistevens authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 couchable/core.py
View
10 couchable/core.py
@@ -316,6 +316,16 @@ def __deepcopy__(self, memo):
# inst = cls.__new__(cls)
# inst.__dict__.update({copy.deepcopy(k): copy.deepcopy(v) for k,v in self.__dict__.items if k not in ['_cdb']})
+ def storeRetryUpdate(self, update_func, what, skip=None, additiveOnly=False):
+ while True:
+ try:
+ update_func(what)
+
+ return self.store(what, skip, additiveOnly)
+ except couchdb.http.ResourceConflict:
+ time.sleep(random.random())
+
+ what = self.load(what)
def store(self, what, skip=None, additiveOnly=False):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.