We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 119ab22 commit f56d3e2Copy full SHA for f56d3e2
src/sentry/incidents/subscription_processor.py
@@ -555,9 +555,13 @@ def trigger_alert_threshold(
555
if options.get("metric_alerts.rate_limit"):
556
# If an incident was created for this rule, trigger type, and subscription
557
# within the last 10 minutes, don't make another one
558
- last_incident: Incident | None = trigger.triggered_incidents.order_by(
559
- "-date_added"
560
- ).first()
+ last_it = (
+ IncidentTrigger.objects.filter(alert_rule_trigger=trigger)
+ .order_by("-incident_id")
561
+ .select_related("incident")
562
+ .first()
563
+ )
564
+ last_incident: Incident | None = last_it.incident if last_it else None
565
last_incident_projects = (
566
[project.id for project in last_incident.projects.all()] if last_incident else []
567
)
0 commit comments