Skip to content

Commit

Permalink
Merge pull request #2048 from h-vetinari/cache
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Sep 1, 2024
2 parents 6bdc9e6 + 14bc2db commit e99a0e0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion conda_smithy/linter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import re
import sys
import time
from collections.abc import Sequence
from functools import lru_cache
from glob import glob
Expand Down Expand Up @@ -208,8 +209,15 @@ def _lint_package_version(version: Optional[str]) -> Optional[str]:
return invalid_version.format(ver=ver, err=e)


@lru_cache(maxsize=1)
def load_linter_toml_metdata():
# ensure we refresh the cache every hour
ttl = 3600
time_salt = int(time.time() / ttl)
return load_linter_toml_metdata_internal(time_salt)


@lru_cache(maxsize=1)
def load_linter_toml_metdata_internal(time_salt):
hints_toml_url = "https://raw.githubusercontent.com/conda-forge/conda-forge-pinning-feedstock/main/recipe/linter_hints/hints.toml"
hints_toml_req = requests.get(hints_toml_url)
if hints_toml_req.status_code != 200:
Expand Down

0 comments on commit e99a0e0

Please sign in to comment.