feat: Add Linear action item syncing for incidents #139
1 issue
code-review: Found 1 issue (1 medium)
Medium
N+1 query pattern when resolving action item assignees - `src/firetower/incidents/services.py:180-197`
The loop at lines 180-202 calls _resolve_assignee_by_email() for each issue with an assignee. This function makes multiple database queries per call: one to look up the user by email, potentially creates user and userprofile records, makes a Slack API call for new users, and then does an ExternalProfile.objects.get_or_create(). With many Linear issues having assignees, this creates an N+1 query pattern that could cause significant performance degradation during sync.
Also found at:
src/firetower/incidents/services.py:187-202
Duration: 533.8s · Tokens: 1.4M in / 19.1k out · Cost: $2.67 (+extraction: $0.00, +merge: $0.00)
Annotations
Check warning on line 197 in src/firetower/incidents/services.py
github-actions / warden: code-review
N+1 query pattern when resolving action item assignees
The loop at lines 180-202 calls `_resolve_assignee_by_email()` for each issue with an assignee. This function makes multiple database queries per call: one to look up the user by email, potentially creates user and userprofile records, makes a Slack API call for new users, and then does an `ExternalProfile.objects.get_or_create()`. With many Linear issues having assignees, this creates an N+1 query pattern that could cause significant performance degradation during sync.
Check warning on line 202 in src/firetower/incidents/services.py
github-actions / warden: code-review
[UM6-FV4] N+1 query pattern when resolving action item assignees (additional location)
The loop at lines 180-202 calls `_resolve_assignee_by_email()` for each issue with an assignee. This function makes multiple database queries per call: one to look up the user by email, potentially creates user and userprofile records, makes a Slack API call for new users, and then does an `ExternalProfile.objects.get_or_create()`. With many Linear issues having assignees, this creates an N+1 query pattern that could cause significant performance degradation during sync.