aboutsummaryrefslogtreecommitdiffstats
path: root/api/graphql/models/lazy_bug.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-06-05 13:23:02 +0200
committerMichael Muré <batolettre@gmail.com>2022-06-05 13:23:02 +0200
commitfe231231c68e1f117b6018e008d6d09812604043 (patch)
tree509330a0efa3066d6c17e07a1aa1fe3dcc5abc17 /api/graphql/models/lazy_bug.go
parent96327c3371ca762d906209c6114092bbf552c0f4 (diff)
downloadgit-bug-fe231231c68e1f117b6018e008d6d09812604043.tar.gz
graphql: fix two invalid mutex lock leading to data races
Diffstat (limited to 'api/graphql/models/lazy_bug.go')
-rw-r--r--api/graphql/models/lazy_bug.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/api/graphql/models/lazy_bug.go b/api/graphql/models/lazy_bug.go
index a7840df2..bc26aaca 100644
--- a/api/graphql/models/lazy_bug.go
+++ b/api/graphql/models/lazy_bug.go
@@ -49,13 +49,13 @@ func NewLazyBug(cache *cache.RepoCache, excerpt *cache.BugExcerpt) *lazyBug {
}
func (lb *lazyBug) load() error {
+ lb.mu.Lock()
+ defer lb.mu.Unlock()
+
if lb.snap != nil {
return nil
}
- lb.mu.Lock()
- defer lb.mu.Unlock()
-
b, err := lb.cache.ResolveBug(lb.excerpt.Id)
if err != nil {
return err