aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-03-27 22:37:08 +0900
committerOphestra <cat@gensokyo.uk>2025-03-27 22:37:08 +0900
commite400862a124bed09cd43d72df46dc46f126487ea (patch)
treea1913529aa200b74ac6d4ed6bb6ed734158fe189 /internal
parent184e9db2b2ee960e7c7b2014aec72a28d9110bcc (diff)
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 <cat@gensokyo.uk>
Diffstat (limited to 'internal')
-rw-r--r--internal/state/multi.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/state/multi.go b/internal/state/multi.go
index ee43ccf3..58b223c1 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