Repository navigation
perf(workspace): use indexed lookups for channel previews - #788
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Workspace sidebar preview requests ranked full historical event rows and reached 10 seconds on the live service. PostgreSQL now skips between distinct channel targets in an index, selects the latest visible matching event per channel, and fetches payloads only for those winners. Legacy channels and previews older than 30 days remain available; equal timestamps use a stable descending event-ID tie-break.
Adds a partial channel-event index through a concurrent migration. SQLite retains a narrow-ID ranking fallback. Existing private-channel and direct-message restrictions apply before selecting each winner; no shared response cache is introduced.
Validation: 30 focused SQLite/PostgreSQL synthetic-data and endpoint privacy tests passed. A broader messaging run had 71 passes and four failures caused by unavailable localhost PostgreSQL connections; the unchanged develop baseline reproduces the same four failures. Read-only, repeatable-read comparisons across two live workspaces and three viewer scopes returned identical channel IDs, timestamps, and payloads. For workspace 2550c9ab (326 previews), owner queries fell from 1.8–3.3 s to 37–113 ms. Direct API checks returned the same 326 previews: existing service 3.1–4.0 s, isolated candidate 178–395 ms; candidate traffic is lighter, so production monitoring follows deployment. Concurrent index migration 082 completed and the index is valid (158 MB).
Deployed as release
ec6cda425. One-minute live samples: preview mean 403 → 143 ms, p95 1933 → 373 ms, maximum 5146 → 780 ms (117/125 preview requests). Overall mean 232 → 114 ms across 20,706/21,672 application requests, with zero 5xx in either sample; CPU remained about 73–75%. All 100 deployment health probes returned 200.