René's URL Explorer Experiment


Title: fix(db): retry the migration connection on transient slot exhaustion by waleedlatif1 · Pull Request #5226 · simstudioai/sim · GitHub

Open Graph Title: fix(db): retry the migration connection on transient slot exhaustion by waleedlatif1 · Pull Request #5226 · simstudioai/sim

X Title: fix(db): retry the migration connection on transient slot exhaustion by waleedlatif1 · Pull Request #5226 · simstudioai/sim

Description: Summary Migrations fail their deploy whenever the production/staging database is momentarily at its connection cap. The migration opens its session on the first query (the advisory-lock acquire); if every non-superuser slot is taken, that connect throws 53300 — "remaining connection slots are reserved for roles with the SUPERUSER attribute" — and the whole migrate step errors out, even though the spike clears within seconds. This adds a bounded connection retry before the lock is acquired. Why this approach (investigated via PlanetScale) The "give the migration role reserved slots" route is not available from here: on the prod cluster, max_connections (200), superuser_reserved_connections (3), and reserved_connections (0) are all context = postmaster — they only change with a database restart and are managed by PlanetScale's cluster sizing, not ALTER SYSTEM. The only online levers (capping the app role's connection limit, or granting pg_use_reserved_connections while reserved_connections = 0) are either ineffective or risk shifting the outage onto the app. The saturation is transient (the DB sits around ~30 connections and briefly spikes), and the migration is a single short-lived session — so retrying the connect is the correct, low-risk fix. Change connectWithRetry() runs SELECT 1 before acquireMigrationLock(), retrying 53300, the 08xxx connection_exception class, and the postgres-js transport codes with jittered backoff (10 attempts, ~90s ceiling). Non-transient errors (auth, bad host/db) still fail fast. Reuses the existing backoffWithJitter / getPostgresErrorCode helpers. Durable capacity follow-up (platform, not in this PR) The root cause is the app saturating ~all 200 slots at peak. Options for the owner to weigh: scale the cluster (raises max_connections), contain the app's pool / route through the pooler, or have PlanetScale set reserved_connections + grant the migration role pg_use_reserved_connections (and revoke it from the app role, which currently holds it). All require platform/cluster action. Type of Change Bug fix (deploy reliability) Testing biome + typecheck clean. Logic exercises on the next migration-bearing deploy; non-transient failures still surface immediately. Checklist Self-reviewed No secrets added or exposed I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary Migrations fail their deploy whenever the production/staging database is momentarily at its connection cap. The migration opens its session on the first query (the advisory-lock acquire); i...

X Description: Summary Migrations fail their deploy whenever the production/staging database is momentarily at its connection cap. The migration opens its session on the first query (the advisory-lock acquire); i...

Opengraph URL: https://github.com/simstudioai/sim/pull/5226

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:9811e17d-6dbd-cca9-1138-13249c898e09
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCD48:39AF8:B5654:10082F:6AFB4621
html-safe-nonce78f039894cfcb9cfc03abd1a08f5f4afaff4005732bd61f32d2b7e72c65a672c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDQ4OjM5QUY4OkI1NjU0OjEwMDgyRjo2QUZCNDYyMSIsInZpc2l0b3JfaWQiOiI3NDI3MTI2Mjg4MTk0NzgwNTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacbabc20a0c5935238cd68a844b427afb6a6657f03925c995c6a11eedc1f1d09a5
hovercard-subject-tagpull_request:3944347354
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/5226/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary Migrations fail their deploy whenever the production/staging database is momentarily at its connection cap. The migration opens its session on the first query (the advisory-lock acquire); i...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneacf7616d06cc051644705b379878c9bb13dc5e70ecf4ffd9b34140f8ac01d7e1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release26504db649b58525278f77a52b80ba5f10d5f4de
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/5226/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5226%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5226%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/5226/files
Reloadhttps://github.com/simstudioai/sim/pull/5226/files
Reloadhttps://github.com/simstudioai/sim/pull/5226/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests199 (199)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
ci-migrate-investigatehttps://github.com/simstudioai/sim/tree/ci-migrate-investigate
Conversation 10 https://github.com/simstudioai/sim/pull/5226
Commits 3 https://github.com/simstudioai/sim/pull/5226/commits
Checks 15 https://github.com/simstudioai/sim/pull/5226/checks
Files changed https://github.com/simstudioai/sim/pull/5226/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5226/files
fix(db): retry the migration connection on transient slot exhaustion https://github.com/simstudioai/sim/pull/5226/files#top
Show all changes 3 commits https://github.com/simstudioai/sim/pull/5226/files
358a957 ci(migrations): skip db:migrate on merges that change no migration files waleedlatif1 Jun 26, 2026 https://github.com/simstudioai/sim/pull/5226/commits/358a9574732c2fc6f39c4cff72ad03e6d3f9a9b3
80348ca fix(db): retry the migration connection on transient slot exhaustion waleedlatif1 Jun 26, 2026 https://github.com/simstudioai/sim/pull/5226/commits/80348ca78724d83ce8a79d8554a7d9c4e262e53d
ac8eeed ci: drop the migration paths-filter gate (out of scope) waleedlatif1 Jun 26, 2026 https://github.com/simstudioai/sim/pull/5226/commits/ac8eeed5fbacebb813d72a9ea5ba576564d0cad4
Clear filters https://github.com/simstudioai/sim/pull/5226/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5226/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5226/files
packages/db/scripts/migrate.tshttps://github.com/simstudioai/sim/pull/5226/files#diff-779c3d10c90f2f40f5bde1dbd478e3b67c3f73e6bd798c8e7a8f3eeca3141eeb
View file https://github.com/simstudioai/sim/blob/ac8eeed5fbacebb813d72a9ea5ba576564d0cad4/packages/db/scripts/migrate.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5226/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5226/files#diff-779c3d10c90f2f40f5bde1dbd478e3b67c3f73e6bd798c8e7a8f3eeca3141eeb
https://github.com/simstudioai/sim/pull/5226/files#diff-779c3d10c90f2f40f5bde1dbd478e3b67c3f73e6bd798c8e7a8f3eeca3141eeb
https://github.com/simstudioai/sim/pull/5226/files#diff-779c3d10c90f2f40f5bde1dbd478e3b67c3f73e6bd798c8e7a8f3eeca3141eeb
Please reload this pagehttps://github.com/simstudioai/sim/pull/5226/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.