Commit dd3395ea authored by rbmead's avatar rbmead

Added exponential backoff to supports_retry to allow time for conflict error to be

resolved before retrying.
parent 2bf4f5ba
...@@ -83,9 +83,9 @@ ...@@ -83,9 +83,9 @@
# #
############################################################################## ##############################################################################
__version__='$Revision: 1.45 $'[11:-2] __version__='$Revision: 1.46 $'[11:-2]
import regex, re, sys, os, string, urllib import regex, re, sys, os, string, urllib, time, whrandom
from string import lower, atoi, rfind, split, strip, join, upper, find from string import lower, atoi, rfind, split, strip, join, upper, find
from BaseRequest import BaseRequest from BaseRequest import BaseRequest
from HTTPResponse import HTTPResponse from HTTPResponse import HTTPResponse
...@@ -175,7 +175,10 @@ class HTTPRequest(BaseRequest): ...@@ -175,7 +175,10 @@ class HTTPRequest(BaseRequest):
_urls = () _urls = ()
retry_max_count=3 retry_max_count=3
def supports_retry(self): return self.retry_count < self.retry_max_count def supports_retry(self):
if self.retry_count < self.retry_max_count:
time.sleep(whrandom.uniform(0, 2**(self.retry_count)))
return 1
def retry(self): def retry(self):
self.retry_count=self.retry_count+1 self.retry_count=self.retry_count+1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment