Skip to content

Commit

Permalink
fix(release): Internal server error on release creation with many com…
Browse files Browse the repository at this point in the history
…mits (#76561)

Simplify transactions and batch insert commits to prevent query from
being killed.

Closes #75902
Fixes [SENTRY-3A3X](https://sentry.sentry.io/issues/5449933085/)
  • Loading branch information
mikejihbe committed Aug 26, 2024
1 parent 95399ef commit 082a90b
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/sentry/models/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,15 +691,7 @@ def set_commits(self, commit_list):
with TimedRetryPolicy(10)(lock.acquire):
start = time()
with (
atomic_transaction(
using=(
router.db_for_write(type(self)),
router.db_for_write(ReleaseCommit),
router.db_for_write(Repository),
router.db_for_write(CommitAuthor),
router.db_for_write(Commit),
)
),
atomic_transaction(using=router.db_for_write(type(self))),
in_test_hide_transaction_boundary(),
):
# TODO(dcramer): would be good to optimize the logic to avoid these
Expand Down Expand Up @@ -798,6 +790,7 @@ def set_commits(self, commit_list):
for patched_file in patch_set
],
ignore_conflicts=True,
batch_size=100,
)

try:
Expand Down

0 comments on commit 082a90b

Please sign in to comment.