Skip to content

fix(sandbox): Avoid redundant workspace fetch in snapshot resolve loop - #2205

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/snapshot-loop-workspace-n-plus-1
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/snapshot-loop-workspace-n-plus-1

Conversation

@sentry

@sentry sentry Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Removes the redundant getWorkspace() query at the top of the resolveWorkspaceSnapshot polling loop. advanceWorkspaceSnapshot already fetches and validates the workspace inside its lock callback, so re-fetching it outside on every polling cycle produced N+1 database queries under POST /api/internal/workspace/snapshots.

Now advanceWorkspaceSnapshot returns the updated workspace along with the snapshot result, allowing the outer loop to reuse that record across iterations without making extra DB round-trips.

Fixes JUNIOR-E1

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Oct 22, 2026 11:04am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview – junior-docs — a015e56a Deployed Oct 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants