diff --git a/cmd/bucket-lifecycle.go b/cmd/bucket-lifecycle.go index d34cec431..f6c74fd17 100644 --- a/cmd/bucket-lifecycle.go +++ b/cmd/bucket-lifecycle.go @@ -233,6 +233,10 @@ func (es *expiryState) enqueueByDays(oi ObjectInfo, event lifecycle.Event, src l // enqueueByNewerNoncurrent enqueues object versions expired by // NewerNoncurrentVersions limit for expiry. func (es *expiryState) enqueueByNewerNoncurrent(bucket string, versions []ObjectToDelete, lcEvent lifecycle.Event) { + if len(versions) == 0 { + return + } + task := newerNoncurrentTask{bucket: bucket, versions: versions, event: lcEvent} wrkr := es.getWorkerCh(task.OpHash()) if wrkr == nil { diff --git a/cmd/data-scanner.go b/cmd/data-scanner.go index 505f51dc1..4ba4a7c4a 100644 --- a/cmd/data-scanner.go +++ b/cmd/data-scanner.go @@ -1051,7 +1051,9 @@ func (i *scannerItem) applyNewerNoncurrentVersionLimit(ctx context.Context, _ Ob }) } - expState.enqueueByNewerNoncurrent(i.bucket, toDel, event) + if len(toDel) > 0 { + expState.enqueueByNewerNoncurrent(i.bucket, toDel, event) + } return objectInfos, nil }