Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm_lazy contacts registry on every request even if metadata is present and fresher than cacheAge #53

Open
sneak opened this issue Sep 29, 2015 · 2 comments

Comments

@sneak
Copy link

sneak commented Sep 29, 2015

Even when I have fresh metadata files only minutes old (my cacheAge is set to 120 minutes), every single registry request to npm_lazy incurs a small roundtrip to the upstream server to check for freshness.

Simulating a network failure to force it to serve the locally cached version would require significantly more logic in my testing environment.

The whole point of a local cache is to avoid network roundtrips. It's latency, not throughput - the amount of data that is cached is under 50 megabytes, which is a fast download. It's the hundreds of roundtrips to fetch metadata that slow it down. There should be an option to operate entirely locally if the metadata is less than cacheAge old, and hit the upstream registry only if it is older (even avoiding the HEAD request to check for modifications). I really don't need to worry about package updates in the last hour. If I did, I wouldn't be using a cache.

@arw180
Copy link

arw180 commented Oct 8, 2015

You can get this behavior by modifying the cacheAge in https://github.com/mixu/npm_lazy/blob/master/config.js. The default is zero (meaning it will request metadata updates every time), despite documentation in the README that says the default is an hour.

@ncoquelet
Copy link

For information, the unit of cacheAge is millisecond.
So if you want to set the cache age to avoid registry request for the next 120 minutes, you need to set
cacheAge: 7200000 or cacheAge: 120 * 60 * 1000

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

No branches or pull requests

3 participants