perf(storage): skip the slug recompute query on non-slug connection updates - #6247
Open
pedrofrxncx wants to merge 1 commit into
Open
perf(storage): skip the slug recompute query on non-slug connection updates#6247pedrofrxncx wants to merge 1 commit into
pedrofrxncx wants to merge 1 commit into
Conversation
pedrofrxncx
enabled auto-merge (squash)
August 19, 2026 15:49
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.
Follows #6240, which stopped
ConnectionStorage.update()decrypting secrets for the slug-merge lookup but still ran that lookup (and the slug recompute) unconditionally on every call.Most calls to
update()never touchapp_name/connection_url/title— the fields the slug is derived from. The hottest one is on the proxy request path (apps/api/src/api/routes/proxy.ts), which callsupdate(connectionId, { status: "active" | "error" })on connection recovery/failure and was paying an extra unnecessary SELECT round-trip for a slug that can't have changed.This adds a presence check (
"app_name" in data || ...) before running the lookup+recompute, so a pure status/heartbeat write skips it entirely. Behavior is unchanged: any update that does touch a slug-source field still goes through the exact same lookup/merge/recompute path as before.How to confirm: read
apps/api/src/storage/connection.tsupdate()— the recompute block is now gated ontouchesSlugField, andserializeConnectionstill only writes fields present indata, so a status-only update still doesn't touchslug.Local checks:
bun run fmt,bunx tsc --noEmit(apps/api, clean),bunx oxlint apps/api/src/storage/connection.ts(0 warnings/errors). No unit test exists for this path (only Postgres-backed integration tests inconnection.integration.test.ts, not runnable here) — full CI validates those.Summary by cubic
Skip slug lookup and recompute in
ConnectionStorage.update()when the update does not touch slug-source fields, removing an extra SELECT on hot status/heartbeat writes. Previouslyupdate()always fetchedapp_name,connection_url, andtitleto recompute the slug; now it does so only if any of those keys are present indata.Behavior for slug-affecting updates is unchanged: the same lookup/merge/recompute path runs, and
serializeConnectionstill only persists provided fields, so status-only updates leavesluguntouched. This targets the proxy path inapps/api/src/api/routes/proxy.tsthat callsupdate(connectionId, { status: ... }).Written for commit 2292c28. Summary will update on new commits.