Probe each source identifier once and prefer the indexed URL
CI / Python 3.13 (push) Successful in 38s
CI / Python 3.12 (push) Successful in 40s
CI / Build and smoke-test image (push) Successful in 10s

This commit is contained in:
omar committed 2026-11-29 11:13:51 +03:00
1 parent 3fef9f0f9b
commit 04b31e6bf3
1 file changed
+6
+6
View File
@@ -845,6 +845,12 @@ class Search:
return {source: _index_status(source, await self._store.state(source)) for source in (*_INDEX_SOURCES, 'kev', 'epss', 'exploitdb', *_EXPLOIT_SOURCES)}
async def _run_checks(self, wanted: set[Check], checked: dict[Check, ProviderPage], deadline: float) -> list[Observation]:
# A cached copy can still carry an older URL for the same identifier; probe
# each source/identifier once, preferring the URL the index vouches for.
preferred: dict[tuple[str, str], Check] = {}
for check in sorted(wanted, key=lambda key: (key.url is None, key.source, key.native_id)):
preferred.setdefault((check.source, check.native_id.upper()), check)
wanted = {check for check in wanted if preferred[(check.source, check.native_id.upper())] is check}
plans: dict[str, list[Check]] = defaultdict(list)
for check in sorted(wanted, key=lambda key: (key.source, key.native_id, key.url or '')):
if check in checked: