Skip to content

#2517 only fetch plugin package info from NPM when needed#2518

Open
RichardBradley wants to merge 1 commit intoalphagov:mainfrom
RichardBradley:2517-fetch-npm-on-demand
Open

#2517 only fetch plugin package info from NPM when needed#2518
RichardBradley wants to merge 1 commit intoalphagov:mainfrom
RichardBradley:2517-fetch-npm-on-demand

Conversation

@RichardBradley
Copy link
Contributor

Fixes #2517

Changes

1; The "pluginVersionSatisfies " function, which is called a lot, doesn't need to make a network fetch to NPM, it can be satisfied from the local package.json data. (This does mean that it will return true for non-plugin packages, but I can't see why that would do any harm)

This saves some dev startup time (see deleted pluginCacheMiddleware)

2: The plugin cache can be made fetch-on-demand, instead of polling every 36 seconds.
I wonder if the 36 second config was a typo for 10 hours: 36000 millis vs 36000 seconds.
I have set the stale time to 1 minute, now that it's not polling all the time.
See deleted startPackageTracker

Testing

All unit tests pass
I have ran a new prototype locally and it starts ok and looks good to me.
The plugins page looks good to me.
The plugin data is fetched from NPM only when the plugins page is viewed.
The prototype will start with no internet (before it refused to even start).

Please let me know if you have any questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

proto kit unusable with slow or no internet: "Failed to load the package cache"

1 participant