Skip to content

Commit

Permalink
Disable cache for layer stats
Browse files Browse the repository at this point in the history
  • Loading branch information
kacpersaw committed Jul 16, 2024
1 parent b8297b1 commit d9349f5
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions api/handler/layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package handler

import (
"github.com/labstack/echo/v4"
"github.com/spacemeshos/explorer-backend/api/cache"
"github.com/spacemeshos/go-spacemesh/log"
"net/http"
"strconv"
Expand All @@ -15,16 +14,11 @@ func LayerStats(c echo.Context) error {
return c.NoContent(http.StatusBadRequest)
}

if cached, ok := cache.Cache.Get("layerStats" + c.Param("id")); ok {
return c.JSON(http.StatusOK, cached)
}

layerStats, err := cc.StorageClient.GetLayerStats(cc.Storage, int64(lid))
if err != nil {
log.Warning("failed to get layer stats: %v", err)
return c.NoContent(http.StatusInternalServerError)
}

cache.Cache.Set("layerStats"+c.Param("id"), layerStats, 0)
return c.JSON(http.StatusOK, layerStats)
}

0 comments on commit d9349f5

Please sign in to comment.