Skip to content

Commit 7dd15fe

Browse files
committed
Move gc.auto.frequency default to a constant.
1 parent 56c8d90 commit 7dd15fe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cargo/core/gc.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const DEFAULT_MAX_AGE_EXTRACTED: &str = "1 month";
3434
/// Default max ago to auto-clean cache data, which must be downloaded to
3535
/// recover.
3636
const DEFAULT_MAX_AGE_DOWNLOADED: &str = "3 months";
37+
/// How often auto-gc will run by default unless overridden in the config.
38+
const DEFAULT_AUTO_FREQUENCY: &str = "1 day";
3739

3840
/// Performs automatic garbage collection.
3941
///
@@ -326,7 +328,12 @@ impl<'a, 'config> Gc<'a, 'config> {
326328
.config
327329
.get::<Option<AutoConfig>>("gc.auto")?
328330
.unwrap_or_default();
329-
let Some(freq) = parse_frequency(auto_config.frequency.as_deref().unwrap_or("1 day"))?
331+
let Some(freq) = parse_frequency(
332+
auto_config
333+
.frequency
334+
.as_deref()
335+
.unwrap_or(DEFAULT_AUTO_FREQUENCY),
336+
)?
330337
else {
331338
tracing::trace!(target: "gc", "auto gc disabled");
332339
return Ok(());

0 commit comments

Comments
 (0)