Skip to content

Commit

Permalink
fixup! Add manifest caching shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
cransom committed Apr 5, 2024
1 parent b2c6b4c commit 92bb508
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/zinc/storages/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from . import StorageBackend

log = logging.getLogger(__name__)
logging.basicConfig(level = logging.DEBUG )


class S3StorageBackend(StorageBackend):
Expand Down Expand Up @@ -67,8 +68,10 @@ def get(self, subpath):
t = TemporaryFile(mode='w+b')
cache_location = os.environ.get('ZINC_CACHE')
if cache_location and exists(os.path.join(cache_location, keyname)):
log.debug(f"GET Cache hit: {subpath} ({keyname})")
t = open(os.path.join(cache_location,keyname), 'rb')
else:
log.debug(f"GET Cache miss: {subpath} ({keyname})")
self._bucket.download_fileobj(keyname, t)
if t.tell() == 0:
return None
Expand Down

0 comments on commit 92bb508

Please sign in to comment.