bundlephobia icon indicating copy to clipboard operation
bundlephobia copied to clipboard

Default install timeout of 30s is too strict

Open transitive-bullshit opened this issue 3 years ago • 0 comments

Up front, I just want to say that I ❤️ Bundlephobia.

Context

As a library author, I keep getting sporadic build errors with https://bundlephobia.com/package/[email protected], and then I noticed that there are dozens of similar issues in this repo.

So I got bundlephobia running locally, and realized that 95% of these sporadic build errors are caused by the timeout being way too aggressive when trying to install the package(s).

For instance, locally this takes anywhere from 24s to 40s:

npm install [email protected]  --cache=/tmp/tmp-build/cache --no-package-lock --no-shrinkwrap --no-optional --no-bin-links --ignore-scripts --save-exact --production --json

^ this command is generated from the accompanying project's worker in package-build-stats.

So even locally with a 1GB connection and no additional traffic, this timeout fails about 50% of the time. If the package can't install, then getAllPackageExports and getPackageExportSizes can't run.

Please describe the feature/suggestion

Increase the default getPackageStats timeout from 30s to 120s.

This PR https://github.com/pastelsky/bundlephobia/pull/596 by @n10l appears to already solve the issue.

As far as I can tell looking through the existing issues in this repo, this timeout is affecting dozens of mid-to-large-sized NPM packages. Since it's a relatively straightforward fix, I'm hoping the upsides outweigh any potential downsides.

Note: if this fix is implemented, we may need to update the API timeout(s) in a few other places of the codebase. Happy to submit a subsequent PR in this case.

transitive-bullshit avatar Apr 01 '22 15:04 transitive-bullshit