aboutsummaryrefslogtreecommitdiff
path: root/objectstore/packed
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-02-21 19:55:48 +0800
committerGravatar Runxi Yu2026-02-21 19:55:48 +0800
commit36bb351d73932b34709dc35ebe37f480b3a0a6fd (patch)
tree380c50d703d8d3495c38c297f5d091135b784f0a /objectstore/packed
parentobjectstore/packed: Optimize pack candidate lookup and locking (diff)
signatureNo signature
objectstore/packed: Best-effort touchCandidate
Diffstat (limited to 'objectstore/packed')
-rw-r--r--objectstore/packed/idx_lookup_candidates.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/objectstore/packed/idx_lookup_candidates.go b/objectstore/packed/idx_lookup_candidates.go
index 23ac9a61..83055aac 100644
--- a/objectstore/packed/idx_lookup_candidates.go
+++ b/objectstore/packed/idx_lookup_candidates.go
@@ -124,8 +124,11 @@ func (store *Store) discoverCandidates() ([]packCandidate, error) {
}
// touchCandidate moves one candidate to the front of the lookup order.
+// This is done on a best-effort basis.
func (store *Store) touchCandidate(packName string) {
- store.candidatesMu.Lock()
+ if !store.candidatesMu.TryLock() {
+ return
+ }
defer store.candidatesMu.Unlock()
node := store.candidateNodeByPack[packName]