-
Notifications
You must be signed in to change notification settings - Fork 363
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
opam update
that are noop should be instantaneous
#5553
Comments
I was told that there's a speedup coming in opam 2.2, in which it won't be necessary to decompress and then delete all the files of Nonetheless, using the
|
This could be relatively easy to implement using the If-Modified-Since HTTP1.1 header. We could store This way we don't really have to deal with parsing and comparing the date which can become tricky very quickly |
Why don't you simply use |
What would be the advantage of etags/If-None-Match over last-modified/If-Modified-Since? So far i prefer the latter because it is meaningful when stored. In the future we can look at that string, parse it and let the user know how long ago they updated (could also be useful for debugging) |
Replying to myself: it is more precise (a resource could in theory be updated several times in a second). EDIT: different servers could also have different time if a server is changed or in the case of a cluster (although i'm not sure for the latter) |
In general they are the robust thing to use as far as caching goes. In a distributed system you can't guarantee that your clock are synchronized, in practice clocks go back in time etc. Additionally files sometimes get |
Note that this depends on how the |
Not sure how feasible this is with nginx and opam.ocaml.org -- but my favourite etag for the index.tar.gz would be the commit id that the tarball refers to. But indeed, the last-modified should be sufficient from a practical point of view (taking into account that opam.ocaml.org recreation scripts take >2 hours anyways, there's no chance the index.tar.gz will be changed multiple times in the same second). The only thing I have to add: since opam.ocaml.org is served by multiple computers, please ensure that the same header (last-modified / etag) is served. |
i have a first rough draft of this feature request in #6283. It works pretty well to reduce the time taken by noop opam update to under half a second. In its current state however it will still need some work but i'm hoping to have it ready for the 2.4 release planned for April. |
When an
opam update
sees that nothing changed in a repository the operation should be instantaneous instead of taking 20s.Also opam should check headers like
last-modified
so that it doesn't actually download the index file if it wasn't changed since the last download.In that example I expect the second
opam update
to take less than 1sThe text was updated successfully, but these errors were encountered: