Merge pull request #2260 from timnyborg/patch-11

no sleep when redis_cache set to fail gracefully
This commit is contained in:
mdipierro
2019-09-29 19:47:13 -07:00
committed by GitHub

View File

@@ -208,12 +208,12 @@ class RedisClient(object):
def retry_call(self, key, f, time_expire, with_lock):
self.RETRIES += 1
if self.RETRIES <= self.MAX_RETRIES:
logger.error("sleeping %s seconds before reconnecting" % (2 * self.RETRIES))
time.sleep(2 * self.RETRIES)
if self.RETRIES <= self.MAX_RETRIES:
if self.fail_gracefully:
self.RETRIES = 0
return f()
logger.error("sleeping %s seconds before reconnecting" % (2 * self.RETRIES))
time.sleep(2 * self.RETRIES)
return self.__call__(key, f, time_expire, with_lock)
else:
self.RETRIES = 0