Skip to content

Commit

Permalink
fix(crons): Move limit back onto QuerySet for incident detection (#80805
Browse files Browse the repository at this point in the history
)

This caused a query regressions in
f4933ee
since the limit was moved off the QuerySet and the query was executed
due to the list comprehension
  • Loading branch information
evanpurkhiser authored Nov 15, 2024
1 parent 8b94066 commit aaa1fa6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sentry/monitors/logic/incidents.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ def try_incident_threshold(
monitor_environment=monitor_env, date_added__lte=failed_checkin.date_added
)
.order_by("-date_added")
.values("id", "date_added", "status")
.values("id", "date_added", "status")[:failure_issue_threshold]
]

# reverse the list after slicing in order to start with oldest check-in
previous_checkins = list(reversed(previous_checkins[:failure_issue_threshold]))
previous_checkins = list(reversed(previous_checkins))

# If we have any successful check-ins within the threshold of
# commits we have NOT reached an incident state
Expand Down

0 comments on commit aaa1fa6

Please sign in to comment.