Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't keep the read lock after traversing the items map (before savin…

…g to the io.Writer) in Save
  • Loading branch information...
commit 3986bff69b77c69cd3c04bc77032e631277b741c 1 parent 5388b25
@pmylund authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 cache.go
View
7 cache.go
@@ -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
}
Please sign in to comment.
Something went wrong with that request. Please try again.