Skip to content

Commit 90d171b

Browse files
committed
refactor(aggregator): use const for vacuum minimum interval and rename constant
1 parent 448407c commit 90d171b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

mithril-aggregator/src/commands/serve_command.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ use mithril_metric::MetricsServer;
1616

1717
use crate::{dependency_injection::DependenciesBuilder, tools::VacuumTracker, Configuration};
1818

19+
const VACUUM_MINIMUM_INTERVAL: TimeDelta = TimeDelta::weeks(1);
20+
1921
/// Server runtime mode
2022
#[derive(Parser, Debug, Clone)]
2123
pub struct ServeCommand {
@@ -180,7 +182,7 @@ impl ServeCommand {
180182
self.perform_database_vacuum_if_needed(
181183
&config.data_stores_directory,
182184
&mut dependencies_builder,
183-
TimeDelta::weeks(1),
185+
VACUUM_MINIMUM_INTERVAL,
184186
&root_logger,
185187
)
186188
.await?;

mithril-aggregator/src/tools/vacuum_tracker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use slog::{debug, info, Logger};
99

1010
use mithril_common::StdResult;
1111

12-
const LAST_VACUUM_FILENAME: &str = "last_vacuum_time";
12+
const LAST_VACUUM_TIME_FILENAME: &str = "last_vacuum_time";
1313

1414
type LastVacuumTime = DateTime<Utc>;
1515

@@ -24,7 +24,7 @@ pub struct VacuumTracker {
2424
impl VacuumTracker {
2525
/// Create a new [VacuumTracker] for the given store directory
2626
pub fn new(store_dir: &Path, interval: TimeDelta, logger: Logger) -> Self {
27-
let last_vacuum_file = store_dir.join(LAST_VACUUM_FILENAME);
27+
let last_vacuum_file = store_dir.join(LAST_VACUUM_TIME_FILENAME);
2828

2929
Self {
3030
tracker_file: last_vacuum_file,

0 commit comments

Comments
 (0)