aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/graphql/models/lazy_bug.go6
-rw-r--r--api/graphql/models/lazy_identity.go6
2 files changed, 6 insertions, 6 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
diff --git a/api/graphql/models/lazy_identity.go b/api/graphql/models/lazy_identity.go
index 002c38e4..451bdd54 100644
--- a/api/graphql/models/lazy_identity.go
+++ b/api/graphql/models/lazy_identity.go
@@ -41,13 +41,13 @@ func NewLazyIdentity(cache *cache.RepoCache, excerpt *cache.IdentityExcerpt) *la
}
func (li *lazyIdentity) load() (*cache.IdentityCache, error) {
+ li.mu.Lock()
+ defer li.mu.Unlock()
+
if li.id != nil {
return li.id, nil
}
- li.mu.Lock()
- defer li.mu.Unlock()
-
id, err := li.cache.ResolveIdentity(li.excerpt.Id)
if err != nil {
return nil, fmt.Errorf("cache: missing identity %v", li.excerpt.Id)