Bound per-endpoint DB concurrency and fix a false-empty UI flash on large APIs - #36
Merged
Merged
Conversation
…arge APIs Found while running vayo scan/export and the docs UI against a real, 600+ endpoint production API: the sequential per-endpoint DB round-trips in scan/export/diff (and the identical logic in @vayo-hq/server's GET /api/spec and GET /api/diff) took minutes at that scale, easily mistaken for a hang. Added mapWithConcurrency to @vayo-hq/schema-engine and switched every one of these loops to it. Separately, the docs UI rendered "No endpoints yet"/"No endpoints captured yet" immediately on load, before the first fetch resolved - indistinguishable from a project with nothing captured, and a real, visible flash on an API slow enough to hit the issue above. DocsApp now tracks the initial-load state and shows a loading message instead.
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.
Summary
Found while running
vayo scan/vayo exportand the docs UI against a real, 600+ endpoint production API (reported directly by a user testing against their own backend):vayo scan's route-merge loop andvayo export/vayo diff's per-endpoint override/example/test-script lookups — plus the identical logic in@vayo-hq/server'sGET /api/spec/GET /api/diff— ran one DB call at a time in a sequentialfor...of. Safe, but measured taking minutes at 600+ endpoints against a real remote MongoDB cluster; a user watchingvayo scanreasonably assumed it had hung and killed it manually (it hadn't — it does correctlyprocess.exit(0)at the end, it just never got there in a reasonable time).Changes
mapWithConcurrency(bounded-concurrencyPromise.all, 20 at a time) to@vayo-hq/schema-engine, shared by bothcliandserversince they duplicate this exact per-endpoint-resolution logic.scan.ts,export.ts,diff.ts, andserver/routes/versions.tsto use it.DocsAppnow tracks whether the initial fetch is still pending (initialLoadPending) and shows "Loading endpoints…" instead of the empty-state message inFolderTree, the main pane, andFullDocView, until it resolves.Test plan
pnpm build— passespnpm lint— cleanpnpm check:boundaries— cleanpnpm test— 653/653 passing (4 new tests formapWithConcurrency; fixed two existing test files'@vayo-hq/schema-enginemocks that didn't account for the new export)