[#1691] metabase: Move cheaper conditions to the front in ListWithCursor()
Some checks failed
Vulncheck / Vulncheck (push) Successful in 1m15s
Build / Build Components (push) Successful in 2m10s
Pre-commit hooks / Pre-commit (push) Successful in 2m44s
Tests and linters / gopls check (push) Successful in 3m46s
OCI image / Build container images (push) Successful in 4m36s
Tests and linters / Run gofumpt (push) Successful in 4m24s
Tests and linters / Lint (push) Successful in 5m11s
Tests and linters / Staticcheck (push) Successful in 5m7s
Tests and linters / Tests (push) Successful in 5m13s
Tests and linters / Tests with -race (push) Has been cancelled

`objectLocked` call is expensive, it does IO. We may omit it if object
is not expired.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2025-03-20 15:28:14 +03:00 committed by Evgenii Stratonikov
parent eb9df85b98
commit e8801dbf49

View file

@ -251,7 +251,7 @@ func selectNFromBucket(bkt *bbolt.Bucket, // main bucket
}
expEpoch, hasExpEpoch := hasExpirationEpoch(&o)
if !objectLocked(bkt.Tx(), cnt, obj) && hasExpEpoch && expEpoch < currEpoch {
if hasExpEpoch && expEpoch < currEpoch && !objectLocked(bkt.Tx(), cnt, obj) {
continue
}