ignore cache if not able to load json file

This commit is contained in:
j 2013-01-31 20:29:21 +05:30
parent e2936705c4
commit 4ae8783d27

View file

@ -264,8 +264,10 @@ class FileCache(Cache):
prefix, i, f = self.files(domain, url_hash) prefix, i, f = self.files(domain, url_hash)
if os.path.exists(i): if os.path.exists(i):
with open(i) as _i: with open(i) as _i:
info = json.load(_i) try:
info = json.load(_i)
except:
return r
now = time.mktime(time.localtime()) now = time.mktime(time.localtime())
expired = now-timeout expired = now-timeout