Probe each source identifier once and prefer the indexed URL
This commit is contained in:
1 parent
3fef9f0f9b
commit
04b31e6bf3
1 file changed
+6
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user