Skip to content

fix(preprod): use get_or_create to avoid duplicate comparison IntegrityError#106490

Merged
trevor-e merged 1 commit intomasterfrom
telkins/fix-preprod-comparison-integrity-error
Jan 20, 2026
Merged

fix(preprod): use get_or_create to avoid duplicate comparison IntegrityError#106490
trevor-e merged 1 commit intomasterfrom
telkins/fix-preprod-comparison-integrity-error

Conversation

@trevor-e
Copy link
Member

Fixes SENTRY-5AZ7

When concurrent task executions try to create the same PreprodArtifactSizeComparison record, an IntegrityError is raised due to the unique constraint on (organization_id, head_size_analysis_id, base_size_analysis_id).

This changes create() to get_or_create() so that if the record already exists, it's returned instead of throwing an error. The downstream _run_size_analysis_comparison function already handles existing comparisons in PROCESSING/SUCCESS/FAILED states.

…tyError

Fixes SENTRY-5AZ7

When concurrent task executions try to create the same
PreprodArtifactSizeComparison record, an IntegrityError is raised due to
the unique constraint on (organization_id, head_size_analysis_id,
base_size_analysis_id).

This changes create() to get_or_create() so that if the record already
exists, it's returned instead of throwing an error. The downstream
_run_size_analysis_comparison function already handles existing
comparisons in PROCESSING/SUCCESS/FAILED states.
@trevor-e trevor-e requested a review from a team as a code owner January 17, 2026 00:44
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 17, 2026
@trevor-e trevor-e merged commit ac0ca22 into master Jan 20, 2026
67 checks passed
@trevor-e trevor-e deleted the telkins/fix-preprod-comparison-integrity-error branch January 20, 2026 22:07
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants