Skip to content

Commit 0615d13

Browse files
kconsandrewshie-sentry
authored andcommitted
fix(aci): Reduce deadlock risk in ActionGroupStatus updates (#92451)
Order ActionGroupStatus updates to ensure consistent row locking order across concurrent executions, potentially avoiding deadlocks. Also limit updates to where date_updated is actually newer, which could theoretically reduce overlap between concurrent update queries. See SENTRY-3WEA.
1 parent 5b5add4 commit 0615d13

File tree

1 file changed

+3
-3
lines changed
  • src/sentry/workflow_engine/processors

1 file changed

+3
-3
lines changed

src/sentry/workflow_engine/processors/action.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ def filter_recently_fired_workflow_actions(
112112
statuses.filter(difference__gt=F("frequency_minutes")).values_list("action_id", flat=True)
113113
)
114114

115-
ActionGroupStatus.objects.filter(action__in=actions_to_include, group=group).update(
116-
date_updated=now
117-
)
115+
ActionGroupStatus.objects.filter(
116+
action__in=actions_to_include, group=group, date_updated__lt=now
117+
).order_by("id").update(date_updated=now)
118118
ActionGroupStatus.objects.bulk_create(
119119
[
120120
ActionGroupStatus(action=action, group=group, date_updated=now)

0 commit comments

Comments
 (0)