commit 3ac1b9fe33c42f53f90f6868d82450213cf844d7
parent dc61d3b6b38874473a40f0ba600e04dd7db111a3
Author: Cameron Moore <moorereason@gmail.com>
Date: Tue, 17 Jan 2017 12:51:24 -0600
tpl: Fix deadlock in cached partials
Cached partials that contained cached partials would create a deadlock.
Fixes #2935
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/tpl/template_funcs.go b/tpl/template_funcs.go
@@ -1541,7 +1541,10 @@ func (tf *templateFuncster) Get(key, name string, context interface{}) (p templa
tf.cachedPartials.Lock()
if p, ok = tf.cachedPartials.p[key]; !ok {
+ tf.cachedPartials.Unlock()
p = tf.t.partial(name, context)
+
+ tf.cachedPartials.Lock()
tf.cachedPartials.p[key] = p
}
tf.cachedPartials.Unlock()