Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure we refresh the linter hints regularly #2048

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading