Protect a read from a map with a mutex
This commit is contained in:
parent
bc18557820
commit
9ed359f964
1 changed files with 2 additions and 0 deletions
|
|
@ -178,7 +178,9 @@ func (s *Server) handleFeedIcon(c *router.Context) {
|
|||
}
|
||||
|
||||
cachekey := "icon:" + strconv.FormatInt(id, 10)
|
||||
s.cache_mutex.Lock()
|
||||
cachedat := s.cache[cachekey]
|
||||
s.cache_mutex.Unlock()
|
||||
if cachedat == nil {
|
||||
feed := s.db.GetFeed(id)
|
||||
if feed == nil || feed.Icon == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue