perf(snapshots): Batch image fetches and add timeouts for snapshot download#116076
Merged
Conversation
0394ef7 to
a1a6070
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 55e4647. Configure here.
…wnload Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mtopo27
approved these changes
May 22, 2026
55e4647 to
fad22c6
Compare
1 task
NicoHinderling
added a commit
that referenced
this pull request
May 22, 2026
…gateway (#116078) ## Summary The emmett API gateway (`src/apigw/proxy.py`) has its own path-based `TIMEOUT_OVERRIDES` dict, separate from the Django gateway's URL-name-based overrides that were added in #116076. Without this entry, snapshot downloads fall back to the httpx client default of `read=60s`, causing HTTP/2 stream errors on large snapshots (40K+ images). Adds `(["/preprodartifacts/snapshots/", "/download/"], 90.0)` to match the path pattern. ## Test plan - [ ] Download a large snapshot (40K images) via `sentry-cli snapshots download` and confirm it no longer fails with HTTP/2 stream errors after ~60s 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Problem
Downloading large snapshots (40K+ images) via
GET /api/0/organizations/{org}/preprodartifacts/snapshots/{id}/download/fails with HTTP/2 stream errors. The endpoint submits all image-fetch futures at once, causing memory spikes and gaps in data flow that trigger connection timeouts.Fix
FETCH_BATCH_SIZE=200instead of submitting all futures at once. Each batch completes before the next starts, keeping a steady flow of ZIP data to the client.future.result(timeout=30)prevents indefinite blocking on slow objectstore reads. Timed-out images are skipped (logged as failures), same as other fetch errors.sentry-api-0-organization-preprod-snapshots-download: 90.0to both sync and async gatewayENDPOINT_TIMEOUT_OVERRIDEdicts.Test plan
🤖 Generated with Claude Code