Use the Git cache for tarball flakes#10038
Conversation
|
I'm happy to review this one. |
We have to support this for `fetchTree { type = "file" }` (and
probably other types of trees that can have a non-directory at the
root, like NARs).
Backported from the lazy-trees branch.
7d65dbb to
cabee98
Compare
| if (res->cached) { | ||
| infoAttrs = cached->infoAttrs; |
There was a problem hiding this comment.
It happens when the tarball metadata is cached in fetcher-cache-v1.sqlite and the tree is still in the Git cache:
auto cached = getCache()->lookupExpired(inAttrs);
...
if (cached && !getTarballCache()->hasObject(getRevAttr(cached->infoAttrs, "treeHash")))
cached.reset();There was a problem hiding this comment.
How's that different from caching logic above?
There was a problem hiding this comment.
Or rather, how is that different from
if (cached && !cached->expired)
return attrsToResult(cached->infoAttrs);?
I guess the answer is expired vs non-expired for impure caching?
There was a problem hiding this comment.
The first one (!cache->expired) is before we do an HTTP request (i.e. it's when the fetcher cache has a cached entry that hasn't exceeded the tarballTTL yet). The second (res->cached) is when the HTTP request returns a cached (304) response.
There was a problem hiding this comment.
Added some comments about this.
Ericson2314
left a comment
There was a problem hiding this comment.
Just a few minor things, basically asking for more comments.
Overall idea definitely looks good!
05b13d5 to
e391fc2
Compare
Ericson2314
left a comment
There was a problem hiding this comment.
OK thanks for the comments, looks good now!
|
This seems to have caused #10395 |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-08-12-nix-team-meeting-minutes-168/50561/1 |
|
Maybe this should use |
|
I've confused this for |
Motivation
This makes Nix use the same Git cache for tarball flakes as GitHub flakes.
Backported from the lazy-trees branch.
Context
Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.