feat(api): separate sandbox state crons - #5010
Open
idagelic wants to merge 1 commit into
Open
Conversation
Signed-off-by: Ivan Dagelic <dagelic.ivan@gmail.com>
|
View your CI Pipeline Execution ↗ for commit d289248
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Pull request overview
This PR refactors sandbox state syncing in SandboxManager by splitting out PENDING_BUILD into its own cron and moving PULLING_SNAPSHOT handling into the restoring-state cron, aiming to reduce contention and improve resilience of state processing.
Changes:
- Exclude
RESTORING,PULLING_SNAPSHOT, andPENDING_BUILDfrom the general per-runner pending sync cron. - Expand the restoring-state cron to also process
PULLING_SNAPSHOT, adjust cadence, and increase batch size. - Introduce a dedicated
sync-pending-build-statescron with a global lock and concurrency limiting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
898
to
902
| const sandboxes = await this.sandboxRepository.find({ | ||
| where: { | ||
| runnerId, | ||
| state: SandboxState.RESTORING, | ||
| state: In([SandboxState.RESTORING, SandboxState.PULLING_SNAPSHOT]), | ||
| pending: true, |
Comment on lines
904
to
906
| select: ['id'], | ||
| take: 50, | ||
| take: 100, | ||
| }) |
Comment on lines
+940
to
+943
| const lockKey = 'sync-pending-build-states' | ||
| if (!(await this.redisLockProvider.lock(lockKey, 1 * 60))) { | ||
| return | ||
| } |
vedranjukic
force-pushed
the
main
branch
2 times, most recently
from
June 23, 2026 14:12
2c15a7f to
b40f732
Compare
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.
Description
Separates the
pending_buildcron from the rest for more resilience, also moves thepulling_snapshotstate to be processed along withrestoringDocumentation
Summary by cubic
Separated sandbox state syncing into dedicated crons to reduce contention and improve reliability.
PENDING_BUILDnow has its own cron, andPULLING_SNAPSHOTis processed with restoring.Written for commit d289248. Summary will update on new commits.