Skip to content

Commit

Permalink
Caching: Set cache filename to appname
Browse files Browse the repository at this point in the history
  • Loading branch information
gtirloni authored and amotl committed Sep 2, 2023
1 parent 6d42ed0 commit d63c310
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions grafana_wtf/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from tqdm.contrib.logging import tqdm_logging_redirect
from urllib3.exceptions import InsecureRequestWarning

from grafana_wtf import __appname__
from grafana_wtf.model import (
DashboardDetails,
DashboardExplorationItem,
Expand Down Expand Up @@ -55,7 +56,7 @@ def enable_cache(self, expire_after=60, drop_cache=False):
log.info(f"Response cache will expire immediately (expire_after=0)")
else:
log.info(f"Response cache will expire after {expire_after} seconds")
requests_cache.install_cache(expire_after=expire_after, use_cache_dir=True)
requests_cache.install_cache(cache_name=__appname__, expire_after=expire_after, use_cache_dir=True)
cache_database_file = requests_cache.get_cache().db_path
log.info(f"Response cache database location is {cache_database_file}")
if drop_cache:
Expand Down Expand Up @@ -525,7 +526,6 @@ def add(item):
items.append(item)

for node in element:

# Directly defined datasources.
if "datasource" in node and node["datasource"]:
ds = node.datasource
Expand Down

0 comments on commit d63c310

Please sign in to comment.