metabase: Move cheaper conditions to the front in ListWithCursor()
Some checks failed
DCO action / DCO (pull_request) Failing after 41s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m0s
Vulncheck / Vulncheck (pull_request) Successful in 2m49s
Build / Build Components (pull_request) Successful in 3m30s
Tests and linters / Staticcheck (pull_request) Successful in 5m3s
Tests and linters / gopls check (pull_request) Successful in 6m2s
Tests and linters / Run gofumpt (pull_request) Successful in 6m21s
Tests and linters / Lint (pull_request) Successful in 6m54s
Tests and linters / Tests with -race (pull_request) Successful in 7m49s
Tests and linters / Tests (pull_request) Successful in 7m54s

`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
parent a49f0717b3
commit 8554214ff1
Signed by: fyrchik
SSH key fingerprint: SHA256:m/TTwCzjnRkXgnzEx9X92ccxy1CcVeinOgDb3NPWWmg

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
}