-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Stabilize automatic garbage collection. #14287
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -95,6 +95,9 @@ ENV_VAR_NAME_3 = { value = "relative/path", relative = true } | |||||||||||||||||||
[future-incompat-report] | ||||||||||||||||||||
frequency = 'always' # when to display a notification about a future incompat report | ||||||||||||||||||||
|
||||||||||||||||||||
[cache] | ||||||||||||||||||||
auto-clean-frequency = "1 day" # How often to perform automatic cache cleaning | ||||||||||||||||||||
|
||||||||||||||||||||
[cargo-new] | ||||||||||||||||||||
vcs = "none" # VCS to use ('git', 'hg', 'pijul', 'fossil', 'none') | ||||||||||||||||||||
|
||||||||||||||||||||
|
@@ -664,6 +667,41 @@ Controls how often we display a notification to the terminal when a future incom | |||||||||||||||||||
* `always` (default): Always display a notification when a command (e.g. `cargo build`) produces a future incompat report | ||||||||||||||||||||
* `never`: Never display a notification | ||||||||||||||||||||
|
||||||||||||||||||||
### `[cache]` | ||||||||||||||||||||
|
||||||||||||||||||||
The `[cache]` table defines settings for cargo's caches. | ||||||||||||||||||||
|
||||||||||||||||||||
#### Global caches | ||||||||||||||||||||
|
||||||||||||||||||||
When running `cargo` commands, Cargo will automatically track which files you are using within the global cache. | ||||||||||||||||||||
Periodically, Cargo will delete files that have not been used for some period of time. | ||||||||||||||||||||
It will delete files that have to be downloaded from the network if they have not been used in 3 months. Files that can be generated without network access will be deleted if they have not been used in 1 month. | ||||||||||||||||||||
|
||||||||||||||||||||
The automatic deletion of files only occurs when running commands that are already doing a significant amount of work, such as all of the build commands (`cargo build`, `cargo test`, `cargo check`, etc.), and `cargo fetch`. | ||||||||||||||||||||
|
||||||||||||||||||||
Automatic deletion is disabled if cargo is offline such as with `--offline` or `--frozen` to avoid deleting artifacts that may need to be used if you are offline for a long period of time. | ||||||||||||||||||||
|
||||||||||||||||||||
> **Note**: This tracking is currently only implemented for the global cache in Cargo's home directory. | ||||||||||||||||||||
> This includes registry indexes and source files downloaded from registries and git dependencies. | ||||||||||||||||||||
> Support for tracking build artifacts is not yet implemented, and tracked in [cargo#13136](https://github.com/rust-lang/cargo/issues/13136). | ||||||||||||||||||||
> | ||||||||||||||||||||
> Additionally, there is an unstable feature to support *manually* triggering cache cleaning, and to further customize the configuration options. | ||||||||||||||||||||
> See the [Unstable chapter](unstable.md#gc) for more information. | ||||||||||||||||||||
|
||||||||||||||||||||
#### `cache.auto-clean-frequency` | ||||||||||||||||||||
* Type: string | ||||||||||||||||||||
* Default: `"1 day"` | ||||||||||||||||||||
* Environment: `CARGO_CACHE_AUTO_CLEAN_FREQUENCY` | ||||||||||||||||||||
|
||||||||||||||||||||
This option defines how often Cargo will automatically delete unused files in the global cache. | ||||||||||||||||||||
This does *not* define how old the files must be, those thresholds are described [above](#global-caches). | ||||||||||||||||||||
|
||||||||||||||||||||
It supports the following settings: | ||||||||||||||||||||
|
||||||||||||||||||||
* `"never"` --- Never deletes old files. | ||||||||||||||||||||
* `"always"` --- Checks to delete old files every time Cargo runs. | ||||||||||||||||||||
* An integer followed by "seconds", "minutes", "hours", "days", "weeks", or "months" --- Checks to delete old files at most the given time frame. | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. “months” is an approximate number. Lines 373 to 381 in ea14e86
I can foresee someone will interpret There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just remove months? It'd be counter-intuitive to anyone trying to use it... The user can already specify something like 180 days for ~6 months, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For myself, being able to say "6 months" is much easier than calculating out the number of days and reading the number of days. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @epage But would anyone expect it to be 182.62125 days? Principle of least surprise... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an inherent approximation when giving a unit. The larger the unit, the larger the approximation. If you say "6 months", you shouldn't care whether thats 180, 186, 182, or 182.62125. btw laughing emoji's in a technical discussion like this come across as rude. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sigh... Here we go again. Intent does not carry across text (or emojis), so please don't jump to conclusions like that. I was not even disagreeing with what you said. Just pointing out that it'd be surpirising for the user, as the OP of this thread has already pointed out (a different surprising aspect). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
168 would be surprising; a bit over 180 not so much. The kind of surprise we're trying to avoid is purging data way earlier than expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If the user goes to the trouble of customizing this in the config, I don't think having to calculate the number of days would be much of an extra hurdle. In effect, removing months would just simplify things with no real downside (and prevent future support questions where people are arguing over this again / trying to figure out what's going on with this approximation). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A month equals 30 days is easier for me to accept |
||||||||||||||||||||
|
||||||||||||||||||||
### `[http]` | ||||||||||||||||||||
|
||||||||||||||||||||
The `[http]` table defines settings for HTTP behavior. This includes fetching | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Forgot to add a line break maybe?
And ditto in doc changes in this PR.
(Assuming we follow https://sembr.org)