Skip to content

Commit

Permalink
fix: Cast certificate cache path to string (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarojasm95 authored Oct 28, 2024
1 parent c987de9 commit af40580
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions aladdin/lib/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def clear_on_error():
except Exception:
logging.info("Clearing cache due to error")
shutil.rmtree(cache_root, ignore_errors=True)
raise


def certificate_cache(func):
Expand All @@ -38,7 +39,10 @@ def certificate_cache(func):
@functools.wraps(func)
@clear_on_error()
def wrapper(certificate_scope):
cache = shelve.open(cache_path)
if not ClusterRules().certificate_lookup_cache:
return func(certificate_scope)

cache = shelve.open(str(cache_path))
data: dict = cache.get(certificate_scope) or {}

age = time.time() - data.get("time", 0)
Expand All @@ -47,7 +51,6 @@ def wrapper(certificate_scope):
if (
not data
or age > ttl.total_seconds()
or not ClusterRules().certificate_lookup_cache
):
value = func(certificate_scope)
cache[certificate_scope] = {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aladdin"
version = "1.29.8.7"
version = "1.29.8.8"
description = ""
authors = ["Fivestars <dev@fivestars.com>"]
include = [
Expand Down

0 comments on commit af40580

Please sign in to comment.