diff options
author | Alex Auvolat <alex@adnab.me> | 2023-08-31 11:36:30 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-08-31 11:36:30 +0200 |
commit | 1cdc321e28ccfbbe425365f3a03a526c3f456e3f (patch) | |
tree | 10d5c0e7c97a25238b24bd3d3961eb2b1ca873d0 /src/model/s3/lifecycle_worker.rs | |
parent | f579d6d9b42ef03d639cc7356b2fa15265074120 (diff) | |
download | garage-1cdc321e28ccfbbe425365f3a03a526c3f456e3f.tar.gz garage-1cdc321e28ccfbbe425365f3a03a526c3f456e3f.zip |
lifecycle worker: don't get stuck on non-existent bucket
Diffstat (limited to 'src/model/s3/lifecycle_worker.rs')
-rw-r--r-- | src/model/s3/lifecycle_worker.rs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/model/s3/lifecycle_worker.rs b/src/model/s3/lifecycle_worker.rs index 0747ffb8..ed762413 100644 --- a/src/model/s3/lifecycle_worker.rs +++ b/src/model/s3/lifecycle_worker.rs @@ -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 |