Commit b571e35
committed
perf(tags): skip redundant inheritance on no-change reimport
Two gates eliminate ~14 wasted queries on a reimport that creates no new
findings or location refs (the common "scheduled rescan, nothing changed"
path):
1. `DefaultReImporter.process_findings` now tracks newly-created findings
in `new_findings_in_batch` (populated in the else branch of the
matched/unmatched dispatch) and passes ONLY those to
`apply_inherited_tags_for_findings`. Matched/existing findings already
had inheritance applied at their original creation, so re-running the
through-table read + Location prefetch chain on them is pure overhead.
2. `LocationManager._persist_locations` now skips
`apply_inherited_tags_for_locations` when no new `LocationProductReference`
rows were created. New `LocationFindingReference`s only add findings
within `self._product`, so they can't change a Location's Product
membership; only a new product ref can. When `all_product_refs` is empty,
the Location's inherited target set is unchanged and the helper would do
a costly no-op read for nothing.
Net effect on the pinned ZAP reimport-no-change baselines:
- V2: 75 → 69 (matches the pre-Phase-A baseline of 69)
- V3: 101 → 81 (beats the pre-Phase-A baseline of 87)1 parent bf0912b commit b571e35
3 files changed
Lines changed: 28 additions & 10 deletions
File tree
- dojo/importers
- unittests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
320 | 325 | | |
321 | 326 | | |
322 | 327 | | |
| |||
399 | 404 | | |
400 | 405 | | |
401 | 406 | | |
| 407 | + | |
| 408 | + | |
402 | 409 | | |
403 | 410 | | |
404 | 411 | | |
| |||
437 | 444 | | |
438 | 445 | | |
439 | 446 | | |
440 | | - | |
441 | | - | |
| 447 | + | |
| 448 | + | |
442 | 449 | | |
443 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
444 | 455 | | |
445 | 456 | | |
446 | 457 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
218 | 225 | | |
219 | 226 | | |
220 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
546 | 546 | | |
547 | 547 | | |
548 | 548 | | |
549 | | - | |
550 | | - | |
| 549 | + | |
| 550 | + | |
0 commit comments