Use defensive cachew

This commit is contained in:
Dima Gerasimov 2020-01-07 00:12:49 +00:00
parent dd93ba8310
commit 5611fce720
5 changed files with 32 additions and 21 deletions

View file

@ -103,8 +103,11 @@ def _iter_locations_fo(fo, start, stop) -> Iterator[Location]:
tag=tag
)
# TODO hope they are sorted...
# TODO hope they are sorted... (could assert for it)
# TODO actually, path includes timestamp already... so mtime_hash isn't _really_ necessary
# TODO CACHEW_OFF env variable?
# TODO use mcachew
from cachew import cachew, mtime_hash
@cachew(cache_path, hashf=mtime_hash, cls=Location, chunk_by=10000, logger=get_logger())
def _iter_locations(path: Path, start=0, stop=None) -> Iterator[Location]:
if path.suffix == '.json':