GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — perf(cli): upgrade check delays fast commands when registry response is slow · Issue #2234 · voidzero-dev/vite-plus Closed Copy link DescriptionDescribe the bugOn commit If the upgrade request is still pending when the command exits, the upgrade check cache is not written. The next invocation performs the same request and experiences the same delay again. I reproduced this with five consecutive invocations. Each invocation made a new registry request, and Expected behavior: a pending upgrade check should not noticeably delay command exit or cause the same registry request on every subsequent invocation. Reproductionhttps://github.com/voidzero-dev/vite-plus/tree/a24eede77ebec23b3e942437bda34f6d34a95cd3 Steps to reproduce1. Build the release CLIcargo build -p vite_global_cli --release --locked 2. Start a local registry that responds after two secondsRun this in a separate terminal: node - <<'JS' const http = require('node:http'); const body = JSON.stringify({ version: '999.0.0', dist: { tarball: '', integrity: '', }, }); http .createServer((request, response) => { console.log('request:', request.url); setTimeout(() => { if (response.destroyed) return; response.writeHead(200, { 'content-type': 'application/json', 'content-length': Buffer.byteLength(body), }); response.end(body); }, 2_000); }) .listen(48_731, '127.0.0.1', () => { console.log('Local registry listening on http://127.0.0.1:48731'); }); JS 3. Configure an isolated test environmentRun this from the Vite+ repository in an interactive terminal: export VP_HOME="$(mktemp -d)" export NPM_CONFIG_REGISTRY="http://127.0.0.1:48731" unset CI unset VP_CLI_TEST unset VP_NO_UPDATE_CHECK The test must run in an interactive terminal because the upgrade check is skipped when stderr is not a TTY. 4. Establish a baselineWarm up the binary once, then measure it with the upgrade check disabled: VP_NO_UPDATE_CHECK=1 target/release/vp env list >/dev/null time VP_NO_UPDATE_CHECK=1 target/release/vp env list On my machine, the command normally completes within a few milliseconds after warm-up. 5. Run the command repeatedly with the delayed registryfor run in 1 2 3 4 5; do echo "Run $run" time target/release/vp env list done Each invocation takes roughly half a second, and the registry terminal prints a new request for every invocation. 6. Inspect the cachetest -f "$VP_HOME/.upgrade-check.json" \ && cat "$VP_HOME/.upgrade-check.json" \ || echo "cache missing" Observed output: System InfoUsed Package ManagerLogsValidations
Activity
MetadataMetadataAssigneesLabelsenhancementNew feature or request TypeFieldsPriority None yet Effort None yet Target date None yet Start date None yet ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |