Skip to content

Commit 85ebf07

Browse files
committed
refine signal
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 1515fd5 commit 85ebf07

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

vulnerabilities/triage/signals.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,18 @@ def delete_triage_records_on_unassign(sender, instance, **kwargs):
4646

4747
@receiver([post_save, post_delete], sender="vulnerabilities.VulnerabilityAnalysis")
4848
def reevaluate_on_analysis_change(sender, instance, **kwargs):
49-
"""Re-evaluate triage when an analysis state or reachability is updated."""
49+
"""Re-evaluate triage on a product when an vulnerability analysis is updated."""
5050
signal = kwargs.get("signal")
5151
if signal == post_save and instance.applied_by_preset_id:
52-
return # Written by the triage engine itself, re-evaluating would loop
52+
# When the analysis is created by the triage engine itself, the evaluation is skipped.
53+
return
5354

54-
# When an user explicitly deletes their analysis, skip preset application to avoid
55+
# When a user explicitly deletes their analysis, skip preset application to avoid
5556
# having the engine immediately recreate it.
56-
is_human_delete = signal == post_delete and not instance.applied_by_preset_id
57+
is_user_delete = signal == post_delete and not instance.applied_by_preset_id
5758
reevaluate_product_rulesets(
5859
instance.product_package.product,
59-
apply_preset=not is_human_delete,
60+
apply_preset=not is_user_delete,
6061
)
6162

6263

0 commit comments

Comments
 (0)