diff options
author | Alex Auvolat <alex@adnab.me> | 2023-08-31 11:25:14 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-08-31 11:25:14 +0200 |
commit | a00a52633f7846c3683da65a07266a03f88b0f74 (patch) | |
tree | d6e2a3845b7cb3f36a6bbe79e2e7b7caf44c130a /src | |
parent | adbf5925de733484998c3a788c4ec7e8cda2cec4 (diff) | |
download | garage-a00a52633f7846c3683da65a07266a03f88b0f74.tar.gz garage-a00a52633f7846c3683da65a07266a03f88b0f74.zip |
lifecycle worker: add log message when starting
Diffstat (limited to 'src')
-rw-r--r-- | src/model/s3/lifecycle_worker.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/model/s3/lifecycle_worker.rs b/src/model/s3/lifecycle_worker.rs index f99cc935..53c84a17 100644 --- a/src/model/s3/lifecycle_worker.rs +++ b/src/model/s3/lifecycle_worker.rs @@ -78,14 +78,7 @@ impl LifecycleWorker { }); let state = match last_completed { Some(d) if d >= today => State::Completed(d), - _ => State::Running { - date: today, - pos: vec![], - counter: 0, - objects_expired: 0, - mpu_aborted: 0, - last_bucket: None, - }, + _ => State::start(today), }; Self { garage, @@ -95,6 +88,20 @@ impl LifecycleWorker { } } +impl State { + fn start(date: NaiveDate) -> Self { + info!("Starting lifecycle worker for {}", date); + State::Running { + date, + pos: vec![], + counter: 0, + objects_expired: 0, + mpu_aborted: 0, + last_bucket: None, + } + } +} + #[async_trait] impl Worker for LifecycleWorker { fn name(&self) -> String { @@ -213,14 +220,7 @@ impl Worker for LifecycleWorker { break; } } - self.state = State::Running { - date: std::cmp::max(next_day, today()), - pos: vec![], - counter: 0, - objects_expired: 0, - mpu_aborted: 0, - last_bucket: None, - }; + self.state = State::start(std::cmp::max(next_day, today())); } State::Running { .. } => (), } |