Commit 78defca3 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Improve no-cache settings

parent a951d053
......@@ -6,6 +6,7 @@ import frictionless
import jinja2
import opendataschema
import pkg_resources
import requests
import requests_cache
from commonmark import commonmark
from pydantic import HttpUrl
......@@ -45,12 +46,15 @@ class SchemaCatalogRegistry:
return opendataschema.SchemaCatalog(ref, session=self.session)
expire_after = timedelta(minutes=config.CACHE_EXPIRE_AFTER)
caching_session = requests_cache.CachedSession(
backend=config.CACHE_BACKEND,
cache_name="validata_ui_cache",
expire_after=expire_after,
)
caching_session = requests.Session()
if config.CACHE_EXPIRE_AFTER != 0:
expire_after = timedelta(minutes=float(config.CACHE_EXPIRE_AFTER)) # type: ignore
caching_session = requests_cache.CachedSession(
backend=config.CACHE_BACKEND,
cache_name="validata_ui_cache",
expire_after=expire_after,
)
fetch_schema = generate_schema_from_url_func(caching_session)
# And load schema catalogs which URLs are found in 'homepage' key of config.yaml
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment