Protect a read from a map with a mutex

This commit is contained in:
Adam Szkoda 2023-05-21 11:16:31 +02:00 committed by nkanaev
parent bc18557820
commit 9ed359f964

View File

@ -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 {