Repository navigation
Commit a820577
authored
perf(setup): download an org in about 2s instead of 30s (#93)
## Value
**V.A.L.U.E. tier:** micro. It's a mechanical change of 36 lines across 3 files, and the before/after timings below prove it.
- **Problem:** connecting an org through the setup wizard is slow. Picking "All" took **31.6s** on an org of about 300 resources. Each API request returns in about 90ms and local work is under a second, so nearly all of that was fixed waiting.
- **Who it affects:** everyone running `npm run setup`, including every [`npx create-vapi-app`](https://www.npmjs.com/package/create-vapi-app) user, plus anyone running `npm run pull`.
## How it works
1. **No `--force` pause for setup's own pulls.** `pull --force` warns and waits 2s so someone typing it by hand can Ctrl+C. The wizard ran one `--force` pull per resource type, so 9 types meant 18s of pauses. setup now sets `VAPI_GITOPS_FORCE_PAUSE=off` for the pulls it starts, following the `VAPI_GITOPS_ORG_PIN=off` convention. A hand-typed `--force` still pauses.
2. **No request gap on GETs.** `api.ts` waited 700ms between every request, reads included, which was about 9 of a plain pull's 11 seconds. Reads now skip the gap. A 429 is still retried with backoff (5 tries from 2s), as the config-free `vapi-client.ts` already does. Writes (POST, PATCH, DELETE) keep the gap.
3. **One pull for "All".** Picking "All" ran 10 processes, each re-fetching credentials and its type's full list. It now runs the same two steps as non-interactive setup: a bindings-only pull, then one full `--force --skip-bindings` pull. "Let me pick…" still pulls by `--id` per type.
4. **Org folder created before the first pull.** The org pin (`.vapi-org.json`) is only written into a folder that already exists. Non-interactive setup creates `resources/<org>/` first, but the wizard didn't, so the pin used to come from its second per-type pull. With a single pull, nothing would have written it, so the wizard now creates the folder first too.
## Verification
These are the exact command sequences each path runs, timed against a real org (`scott-dev`: 8 tools, 13 assistants, 8 structured outputs, 2 squads, 11 personalities, 118 scenarios, 118 simulations, 11 suites, 8 evals). They used read-only pulls in a throwaway copy of the repo.
| Path | Before | After |
|---|---|---|
| Wizard, "All" | 31.6s | **2.2–2.5s** |
| Wizard, "Let me pick…" with everything picked | 31.6s | 6.2s |
| Non-interactive setup / `npm run pull` | 11.1s | ~2.4s |
| Hand-typed `npm run pull -- <org> --force` | 11.1s | 3.8s (still pauses 2s) |
- **Output unchanged:** "All" via one pull and "pick everything" via per-type pulls wrote identical trees, 298 files, `.vapi-org.json` included.
- **No rate limiting:** none of the runs logged a 429 retry. Separately, 11 concurrent list requests against production all returned 200.
- `npm run build` passes, and `npm test` passes 584/584.
🤖 Generated with [Claude Code](https://claude.com/claude-code)3 files changed
Lines changed: 36 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
190 | 193 | | |
191 | 194 | | |
192 | 195 | | |
193 | | - | |
194 | 196 | | |
195 | 197 | | |
196 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1291 | 1291 | | |
1292 | 1292 | | |
1293 | 1293 | | |
1294 | | - | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
1295 | 1301 | | |
1296 | 1302 | | |
1297 | 1303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| 307 | + | |
| 308 | + | |
307 | 309 | | |
308 | 310 | | |
309 | | - | |
| 311 | + | |
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
313 | 315 | | |
314 | 316 | | |
315 | | - | |
| 317 | + | |
316 | 318 | | |
317 | 319 | | |
318 | 320 | | |
| |||
332 | 334 | | |
333 | 335 | | |
334 | 336 | | |
| 337 | + | |
335 | 338 | | |
336 | 339 | | |
337 | 340 | | |
| |||
340 | 343 | | |
341 | 344 | | |
342 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
343 | 355 | | |
344 | 356 | | |
345 | 357 | | |
| |||
704 | 716 | | |
705 | 717 | | |
706 | 718 | | |
| 719 | + | |
707 | 720 | | |
708 | 721 | | |
709 | 722 | | |
| |||
738 | 751 | | |
739 | 752 | | |
740 | 753 | | |
| 754 | + | |
741 | 755 | | |
742 | 756 | | |
743 | 757 | | |
| |||
796 | 810 | | |
797 | 811 | | |
798 | 812 | | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
799 | 816 | | |
800 | 817 | | |
801 | 818 | | |
802 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
803 | 825 | | |
804 | 826 | | |
805 | 827 | | |
| |||
0 commit comments