Merge pull request #2260 from timnyborg/patch-11

no sleep when redis_cache set to fail gracefully
This commit is contained in:
mdipierro authored and GitHub committed 2019-09-29 19:47:13 -07:00
commit 501d0b8a9b
1 file changed
+2 -2
+2 -2
View File
@@ -209,11 +209,11 @@ 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.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