diff --git a/iiif/utils.py b/iiif/utils.py index bb54f37..f74e061 100644 --- a/iiif/utils.py +++ b/iiif/utils.py @@ -290,7 +290,7 @@ def pct(self) -> str: :return: the percentage the cache is in use as a formatted string """ - return f'{(self.total_size / self.max_size):.2f}%' + return f'{((self.total_size / self.max_size) * 100):.2f}%' def _clean_up(self, path: Path): """ @@ -361,7 +361,11 @@ async def use(self, fetchable: Fetchable) -> Path: elif not path.exists(): async with self._locker.acquire(path, timeout=self.fetch_timeout): if not path.exists(): - await self._fetch(fetchable) + try: + await self._fetch(fetchable) + except Exception: + self.errors += 1 + raise self._sizes[path] = path.stat().st_size self.total_size += self._sizes[path] diff --git a/setup.py b/setup.py index 38890de..d15e192 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ setup( name="iiif-image-server", - version='0.10.0', + version='0.12.1', author='Natural History Museum', author_email='data@nhm.ac.uk', description="A media server primarily used by the NHM Data Portal",