Bug fix: Deleting from empty map.

Signed-off-by: thatInfrastructureGuy <thatInfrastructureGuy@gmail.com>
pull/880/head
thatInfrastructureGuy 4 years ago
parent 559e0b9ff4
commit 75e2e57a92
No known key found for this signature in database
GPG Key ID: 69A1BCB2103158E6

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

Loading…
Cancel
Save