From e400862a124bed09cd43d72df46dc46f126487ea Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 27 Mar 2025 22:37:08 +0900 Subject: [PATCH] state/multi: fix backend cache population race This race is never able to happen since no caller concurrently requests the same aid yet. Signed-off-by: Ophestra --- internal/state/multi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/state/multi.go b/internal/state/multi.go index ee43ccf..58b223c 100644 --- a/internal/state/multi.go +++ b/internal/state/multi.go @@ -33,10 +33,10 @@ func (s *multiStore) Do(aid int, f func(c Cursor)) (bool, error) { // load or initialise new backend b := new(multiBackend) + b.lock.Lock() if v, ok := s.backends.LoadOrStore(aid, b); ok { b = v.(*multiBackend) } else { - b.lock.Lock() b.path = path.Join(s.base, strconv.Itoa(aid)) // ensure directory