Return whether any configured source is missing or past its TTL.
(self, *, now: float | None = None)
| 305 | return total |
| 306 | |
| 307 | def needs_refresh(self, *, now: float | None = None) -> bool: |
| 308 | """Return whether any configured source is missing or past its TTL.""" |
| 309 | now = time.time() if now is None else float(now) |
| 310 | for provider in self._providers: |
| 311 | source_data = self._sources.get(provider.source_name, {}) |
| 312 | if not source_data: |
| 313 | if isinstance(provider, LocalFileProvider) and not provider._path.exists(): |
| 314 | continue |
| 315 | return True |
| 316 | newest = max((e.fetched_at for e in source_data.values()), default=0.0) |
| 317 | if now - newest >= provider.refresh_interval_s: |
| 318 | return True |
| 319 | return False |
| 320 | |
| 321 | def refresh_if_stale(self, *, background: bool = True, force: bool = False) -> bool: |
| 322 | """Refresh stale benchmark data without blocking normal routing. |