-
Notifications
You must be signed in to change notification settings - Fork 255
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
Make Cache of Node Index URL Aware #242
Comments
This is an interesting question. At least for tools like Node and Yarn, I feel like the URL doesn't really matter to the cache. There is only one Node 10.4.0, no matter where you got it from. (Same with Yarn.) In both of these cases, it seems like the role of the hooks is just to be able to fetch the distro from a different provider, but the bits it provides are intended to be the same. You could make the same argument for public npm packages as well. But then there's private npm packages, where the same package name could result in different bits depending on where you get it from. But even that might be sort of theoretical. |
I think for packages and the node / npm / yarn tarballs, you’re right that there should only be one version, regardless of where it comes from. I could have been more clear, but this issue is a little more limited in scope: I’m specifically looking at the cache of the Node index, the list of Node versions that are potentially available. It’s a very corner case, but the potential bug is if you fetch and cache the index from the public index, which has all released versions. Then you switch your hooks so that you are trying to download from a private source that only has a subset of Node versions available. The index will still be cached, so Notion will think that there are more versions available than there actually are. Until the cache expires, there will be a disconnect between the cached index and the actual index. Since it only applies when you have an active cache and then change the hooks, it’s a corner case at best, but worth looking into at some point. |
Now that we support per-project hooks, this issue has come up a bit more frequently. Since the index URL can change just by switching directories, it is relatively easy to wind up in a situation where you have a public index, but then try to run a command within a folder with hooks and things fail because it uses the wrong index. |
Currently, the cache of the Node Version Index is a single file. With the addition of Hooks that allow the customization of the download URL, it is possible that the request URL will change.
The cache should be aware of the requested URL and only serve the cached version if the same URL is requested. We probably want to support multiple caches (within reason), since we will also want to cache the Yarn Version Index eventually as well.
The text was updated successfully, but these errors were encountered: