Skip to content

Remove global fetcher cache #13223

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

Merged
merged 2 commits into from
May 18, 2025
Merged

Remove global fetcher cache #13223

merged 2 commits into from
May 18, 2025

Conversation

edolstra
Copy link
Member

Motivation

This removes the global fetcher cache object (the getCache() singleton) and moves the cache into fetchers::Settings. This is a bit of an abuse of fetchers::Settings but I didn't want to add another class to pass around everywhere.

Context

This is cherry-picked from DeterminateSystems#49, which adds a builtin:fetch-tree builtin builder. Since builtin builders run in a forked child process, we cannot use any of the parent's global state (like the fetcher cache's SQLite database) since that's invalid in the child (e.g. it refers to file handles that don't exist in the child). Thus we use a new fetchers::Settings object to avoid touching the parent's fetcher cache.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@edolstra edolstra requested a review from roberth as a code owner May 17, 2025 18:01
@github-actions github-actions bot added new-cli Relating to the "nix" command fetching Networking with the outside (non-Nix) world, input locking labels May 17, 2025
@Mic92 Mic92 merged commit f267188 into master May 18, 2025
25 checks passed
@Mic92 Mic92 deleted the remove-global-fetcher-cache branch May 18, 2025 13:58
@Ericson2314
Copy link
Member

Ericson2314 commented May 18, 2025

@edolstra Thank you for joining me in the war against global variables! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fetching Networking with the outside (non-Nix) world, input locking new-cli Relating to the "nix" command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants