mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-28 21:21:40 -05:00
parent
e66d813bcb
commit
6233ddf9d1
1 changed files with 6 additions and 8 deletions
|
@ -120,19 +120,17 @@ func (ns *Namespace) getOrCreate(key, name string, context interface{}) (interfa
|
|||
return p, nil
|
||||
}
|
||||
|
||||
ns.cachedPartials.Lock()
|
||||
defer ns.cachedPartials.Unlock()
|
||||
|
||||
// Double-check.
|
||||
if p, ok = ns.cachedPartials.p[key]; ok {
|
||||
return p, nil
|
||||
}
|
||||
|
||||
p, err := ns.Include(name, context)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ns.cachedPartials.Lock()
|
||||
defer ns.cachedPartials.Unlock()
|
||||
// Double-check.
|
||||
if p2, ok := ns.cachedPartials.p[key]; ok {
|
||||
return p2, nil
|
||||
}
|
||||
ns.cachedPartials.p[key] = p
|
||||
|
||||
return p, nil
|
||||
|
|
Loading…
Reference in a new issue