object lifecycles (fix #309) #620
1 changed files with 16 additions and 16 deletions
|
@ -78,14 +78,7 @@ impl LifecycleWorker {
|
||||||
});
|
});
|
||||||
let state = match last_completed {
|
let state = match last_completed {
|
||||||
Some(d) if d >= today => State::Completed(d),
|
Some(d) if d >= today => State::Completed(d),
|
||||||
_ => State::Running {
|
_ => State::start(today),
|
||||||
date: today,
|
|
||||||
pos: vec![],
|
|
||||||
counter: 0,
|
|
||||||
objects_expired: 0,
|
|
||||||
mpu_aborted: 0,
|
|
||||||
last_bucket: None,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
Self {
|
Self {
|
||||||
garage,
|
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]
|
#[async_trait]
|
||||||
impl Worker for LifecycleWorker {
|
impl Worker for LifecycleWorker {
|
||||||
fn name(&self) -> String {
|
fn name(&self) -> String {
|
||||||
|
@ -213,14 +220,7 @@ impl Worker for LifecycleWorker {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.state = State::Running {
|
self.state = State::start(std::cmp::max(next_day, today()));
|
||||||
date: std::cmp::max(next_day, today()),
|
|
||||||
pos: vec![],
|
|
||||||
counter: 0,
|
|
||||||
objects_expired: 0,
|
|
||||||
mpu_aborted: 0,
|
|
||||||
last_bucket: None,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
State::Running { .. } => (),
|
State::Running { .. } => (),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue