object lifecycles (fix #309) #620

Merged
lx merged 25 commits from bucket-lifecycle into next 2023-09-04 09:45:11 +00:00
Showing only changes of commit a00a52633f - Show all commits

View file

@ -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 { .. } => (),
}