Merge pull request #880 from thatInfrastructureGuy/BugFix/chartReloadIssue

Bug fix: Deleting from empty map.
pull/859/head^2
Hunter Long 2020-12-14 13:36:47 -08:00 committed by GitHub
commit 6ca0f22665
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -1,10 +1,11 @@
package handlers
import (
"github.com/statping/statping/utils"
"net/url"
"sync"
"time"
"github.com/statping/statping/utils"
)
var CacheStorage Cacher
@ -90,8 +91,8 @@ func (s Storage) List() map[string]Item {
//Get a cached content by key
func (s Storage) Get(key string) []byte {
item := s.items[key]
if s.items[key].Expired() {
CacheStorage.Delete(key)
if item.Expired() {
s.Delete(key)
return nil
}
return item.Content