MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _rediscovery_loop

Function _rediscovery_loop

uncommon_route/proxy.py:2973–2985  ·  view source on GitHub ↗

Periodically re-discover upstream models to track changes.

()

Source from the content-addressed store, hash-verified

2971 _benchmark_refresh_task = None
2972
2973 async def _rediscovery_loop() -> None:
2974 """Periodically re-discover upstream models to track changes."""
2975 import asyncio
2976 interval = float(os.environ.get("UNCOMMON_ROUTE_REDISCOVERY_INTERVAL", "300"))
2977 while True:
2978 await asyncio.sleep(interval)
2979 try:
2980 count = await _mapper.discover(_primary_api_key or None)
2981 if count > 0:
2982 _refresh_active_pricing()
2983 logger.info("Rediscovery: %d models from %s", count, _mapper.provider)
2984 except Exception as exc: # noqa: BLE001
2985 logger.warning("Rediscovery failed: %s", exc)
2986
2987 async def _benchmark_refresh_loop() -> None:
2988 """Refresh external benchmark priors off the request path.

Callers 1

_lifespanFunction · 0.85

Calls 4

_refresh_active_pricingFunction · 0.85
discoverMethod · 0.80
infoMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected