pkgx icon indicating copy to clipboard operation
pkgx copied to clipboard

Store etag So Downloads Use Cache

Open Xercesblu3 opened this issue 3 years ago • 8 comments
trafficstars

store and use etag in useDownload() so github.com downloads use cache

Xercesblu3 avatar Oct 18 '22 19:10 Xercesblu3

@kunalgoyal9 this one is a priority to get completed before launch please.

Xercesblu3 avatar Oct 20 '22 15:10 Xercesblu3

@kunalgoyal9 get this one done when you can please.

Xercesblu3 avatar Nov 08 '22 16:11 Xercesblu3

Sure, @Xercesblu3 Can I get more detail on this one please

kunalgoyal9 avatar Nov 09 '22 08:11 kunalgoyal9

Downloads should return the etag header, which you can pass back on subsequent queries to see if the response would be different or not.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag

If we save this with useCache/useDownload downloads, we should be able to quickly know if our cache item is valid or not, rather than redownloading it every time. Useful for things like rust or llvm sources.

jhheider avatar Nov 09 '22 08:11 jhheider

@jhheider right now we are using If-Modified-since from header to check for cache... Now should we include etag as well.. right?

kunalgoyal9 avatar Nov 09 '22 14:11 kunalgoyal9

I wonder if GitHub honors if-modified. Those should be redundant.

jhheider avatar Nov 09 '22 16:11 jhheider

Thank you for helping explain @jhheider

Xercesblu3 avatar Nov 09 '22 16:11 Xercesblu3

GitHub does not provide modified-since for source tarballs for some reason. Hence this request. We already do If-Modified in useDownload

mxcl avatar Nov 09 '22 18:11 mxcl