lifecycle worker: take into account disabled rules
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Alex 2023-08-30 23:52:09 +02:00
parent 5fad4c4658
commit b2f679675e

View file

@ -243,11 +243,15 @@ async fn process_object(
.and_then(|s| s.lifecycle_config.get().as_deref()) .and_then(|s| s.lifecycle_config.get().as_deref())
.unwrap_or_default(); .unwrap_or_default();
if lifecycle_policy.is_empty() { if lifecycle_policy.iter().all(|x| !x.enabled) {
return Ok(Skip::SkipBucket); return Ok(Skip::SkipBucket);
} }
for rule in lifecycle_policy.iter() { for rule in lifecycle_policy.iter() {
if !rule.enabled {
continue;
}
if let Some(pfx) = &rule.filter.prefix { if let Some(pfx) = &rule.filter.prefix {
if !object.key.starts_with(pfx) { if !object.key.starts_with(pfx) {
continue; continue;