Don't keep the read lock after traversing the items map (before saving to the io.Writer) in Save

master
Patrick Mylund Nielsen 12 years ago
parent 5388b25b3b
commit 3986bff69b

@ -876,11 +876,12 @@ func (c *cache) Save(w io.Writer) (err error) {
}
}()
c.RLock()
defer c.RUnlock()
for _, v := range c.items {
items := c.items
for _, v := range items {
gob.Register(v.Object)
}
err = enc.Encode(&c.items)
c.RUnlock()
err = enc.Encode(&items)
return
}

Loading…
Cancel
Save