Skip to content

Commit db39280

Browse files
author
Fabien Coelho
committed
hmmm... add protection for redis
1 parent bd0829e commit db39280

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,16 @@ def reset_cache(cache):
4141
cache.clear()
4242
except: # fails on redis
4343
pass
44-
if hasattr(cache, "_cache") and hasattr(cache._cache, "reset"):
45-
cache._cache.reset()
46-
if hasattr(cache, "_cache2") and hasattr(cache._cache2, "reset"):
47-
cache._cache2.reset()
44+
try:
45+
if hasattr(cache, "_cache") and hasattr(cache._cache, "reset"):
46+
cache._cache.reset()
47+
except: # fails on redis
48+
pass
49+
try:
50+
if hasattr(cache, "_cache2") and hasattr(cache._cache2, "reset"):
51+
cache._cache2.reset()
52+
except: # fails on redis
53+
pass
4854

4955

5056
def run_cached_keys(cache):

0 commit comments

Comments
 (0)