Delete empty cache files
When a cache filler function returns without success, we need to delete the empty file we create so that it doesn't trigger a false positive the next time we access it.
This commit is contained in:
parent
ba90106588
commit
4f899c4834
|
@ -7,6 +7,7 @@ mkdir = path.mkdir
|
||||||
exists = path.exists
|
exists = path.exists
|
||||||
join = path.join
|
join = path.join
|
||||||
ls = path.ls
|
ls = path.ls
|
||||||
|
rm = path.rm
|
||||||
|
|
||||||
CACHE_DIR = expand("~/.saria/cache")
|
CACHE_DIR = expand("~/.saria/cache")
|
||||||
mkdir(CACHE_DIR)
|
mkdir(CACHE_DIR)
|
||||||
|
@ -26,6 +27,9 @@ class CacheObject:
|
||||||
pass
|
pass
|
||||||
if success:
|
if success:
|
||||||
return path
|
return path
|
||||||
|
else:
|
||||||
|
rm(path)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue