Skip to content

Commit

Permalink
Merge pull request #50 from conda-forge/bust-cache
Browse files Browse the repository at this point in the history
fix: bust the caches
  • Loading branch information
beckermr authored Sep 10, 2024
2 parents a358ed1 + 82069ac commit b76a908
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions conda_forge_metadata/feedstock_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FeedstockOutputsConfig(TypedDict):


@lru_cache(maxsize=1)
def feedstock_outputs_config() -> FeedstockOutputsConfig:
def _feedstock_outputs_config(time_int: int) -> FeedstockOutputsConfig:
ref = "main"
req = requests.get(
"https://raw.githubusercontent.com/conda-forge/feedstock-outputs/"
Expand All @@ -26,6 +26,10 @@ def feedstock_outputs_config() -> FeedstockOutputsConfig:
return req.json()


def feedstock_outputs_config() -> FeedstockOutputsConfig:
return _feedstock_outputs_config(int(time.monotonic()) // 120)


def sharded_path(name: CondaPackageName) -> str:
"""
Get the path to the sharded JSON path in the feedstock_outputs repository.
Expand Down Expand Up @@ -57,7 +61,7 @@ def sharded_path(name: CondaPackageName) -> str:


@lru_cache(maxsize=1)
def _fetch_allowed_autoreg_feedstock_globs(time_int):
def _fetch_allowed_autoreg_feedstock_globs(time_int: int):
r = requests.get(
"https://raw.githubusercontent.com/conda-forge/feedstock-outputs/"
"main/feedstock_outputs_autoreg_allowlist.yml"
Expand All @@ -68,7 +72,7 @@ def _fetch_allowed_autoreg_feedstock_globs(time_int):


def fetch_allowed_autoreg_feedstock_globs():
return _fetch_allowed_autoreg_feedstock_globs(time.monotonic() // 120)
return _fetch_allowed_autoreg_feedstock_globs(int(time.monotonic()) // 120)


fetch_allowed_autoreg_feedstock_globs.cache_clear = (
Expand All @@ -77,21 +81,9 @@ def fetch_allowed_autoreg_feedstock_globs():


@lru_cache(maxsize=1024)
def package_to_feedstock(name: CondaPackageName, **request_kwargs: Any) -> List[str]:
"""Map a package name to the feedstock name(s).
Parameters
----------
package : str
The name of the package.
request_kwargs : dict
Keyword arguments to pass to ``requests.get``.
Returns
-------
feedstock : list of str
The name of the feedstock, without the ``-feedstock`` suffix.
"""
def _package_to_feedstock(
name: CondaPackageName, time_int: int, **request_kwargs: Any
) -> List[str]:
assert name, "name must not be empty"

feedstocks = set()
Expand All @@ -115,6 +107,24 @@ def package_to_feedstock(name: CondaPackageName, **request_kwargs: Any) -> List[
return list(feedstocks)


def package_to_feedstock(name: CondaPackageName, **request_kwargs: Any) -> List[str]:
"""Map a package name to the feedstock name(s).
Parameters
----------
package : str
The name of the package.
request_kwargs : dict
Keyword arguments to pass to ``requests.get``.
Returns
-------
feedstock : list of str
The name of the feedstock, without the ``-feedstock`` suffix.
"""
return _package_to_feedstock(name, int(time.monotonic()) // 120, **request_kwargs)


if __name__ == "__main__":
import sys

Expand Down

0 comments on commit b76a908

Please sign in to comment.