Skip to content

Commit 78cc2af

Browse files
committed
revert lock timing.
1 parent 723a95f commit 78cc2af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/localcache/lru/lru_lazy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ func (x *LazyLRU[K, V]) Get(key K, fetch func() (V, error)) (V, error) {
5959
x.lock.Lock()
6060
v, ok := x.core.Get(key)
6161
if ok {
62-
v.lock.Lock()
6362
x.lock.Unlock()
63+
v.lock.Lock()
6464
expires, value, err := v.expires, v.value, v.err
6565
if expires != 0 && expires > time.Now().UnixMilli() {
6666
v.lock.Unlock()
@@ -129,7 +129,7 @@ func (x *LazyLRU[K, V]) GetBatch(keys []K, fetch func(keys []K) (map[K]V, error)
129129
err = fetchErr
130130
})
131131
}
132-
132+
133133
for key, val := range values {
134134
v := &lazyLruItem[V]{}
135135
v.value = val

0 commit comments

Comments
 (0)