lifecycle worker: don't get stuck on non-existent bucket

This commit is contained in:
Alex 2023-08-31 11:36:30 +02:00
parent f579d6d9b4
commit 1cdc321e28

View file

@ -249,11 +249,22 @@ async fn process_object(
let bucket = match last_bucket.take() {
Some(b) if b.id == object.bucket_id => b,
_ => garage
.bucket_table
.get(&EmptyKey, &object.bucket_id)
.await?
.ok_or_message("object in non-existent bucket")?,
_ => {
match garage
.bucket_table
.get(&EmptyKey, &object.bucket_id)
.await?
{
Some(b) => b,
None => {
warn!(
"Lifecycle worker: object in non-existent bucket {:?}",
object.bucket_id
);
return Ok(Skip::SkipBucket);
}
}
}
};
let lifecycle_policy: &[LifecycleRule] = bucket