Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the agent-cache-refresher on the explorer backend #170

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.60.3
only-new-issues: true
args: --timeout=10m --config=.golangci.yml --out-format=github-actions --issues-exit-code=0
args: --timeout=10m --config=.golangci.yml --out-format=github-actions

docker-push:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ WORKDIR /src
COPY . .
RUN apk add --no-cache gcc musl-dev
RUN go build -o explorer-stats-api ./cmd/api/
RUN go build -o cache-agent-refresh ./cmd/cache-agent-refresh/

FROM alpine:3.17
COPY --from=build /src/explorer-stats-api /bin/
COPY --from=build /src/cache-agent-refresh /bin/
EXPOSE 5000
EXPOSE 5050
EXPOSE 5070
Expand Down
4 changes: 2 additions & 2 deletions api/cache/cache.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package cache

import (
"github.com/eko/gocache/lib/v4/metrics"
"github.com/prometheus/client_golang/prometheus"
"time"

"github.com/eko/gocache/lib/v4/cache"
"github.com/eko/gocache/lib/v4/marshaler"
"github.com/eko/gocache/lib/v4/metrics"
"github.com/eko/gocache/lib/v4/store"
gocacheStore "github.com/eko/gocache/store/go_cache/v4"
redis_store "github.com/eko/gocache/store/redis/v4"
gocache "github.com/patrickmn/go-cache"
"github.com/prometheus/client_golang/prometheus"
"github.com/redis/go-redis/v9"

"github.com/spacemeshos/go-spacemesh/log"
Expand Down
1 change: 0 additions & 1 deletion api/handler/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func Account(c echo.Context) error {
log.Warning("failed to cache account stats: %v", err)
return c.NoContent(http.StatusInternalServerError)
}
cache.LastUpdated.WithLabelValues("/account/" + address).SetToCurrentTime()

return c.JSON(http.StatusOK, accountStats)
}
2 changes: 1 addition & 1 deletion api/handler/circulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package handler

import (
"context"
"github.com/spacemeshos/explorer-backend/api/cache"
"net/http"

"github.com/labstack/echo/v4"
"github.com/spacemeshos/explorer-backend/api/cache"
"github.com/spacemeshos/explorer-backend/api/storage"

"github.com/spacemeshos/go-spacemesh/log"
Expand Down
2 changes: 1 addition & 1 deletion api/handler/epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package handler
import (
"context"
"fmt"
"github.com/spacemeshos/explorer-backend/api/cache"
"net/http"
"strconv"

"github.com/labstack/echo/v4"
"github.com/spacemeshos/explorer-backend/api/cache"
"github.com/spacemeshos/explorer-backend/api/storage"

"github.com/spacemeshos/go-spacemesh/log"
Expand Down
2 changes: 1 addition & 1 deletion api/handler/overview.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package handler

import (
"context"
"github.com/spacemeshos/explorer-backend/api/cache"
"net/http"

"github.com/labstack/echo/v4"
"github.com/spacemeshos/explorer-backend/api/cache"
"github.com/spacemeshos/explorer-backend/api/storage"

"github.com/spacemeshos/go-spacemesh/log"
Expand Down
2 changes: 0 additions & 2 deletions api/handler/smesher.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,5 @@ func Smesher(c echo.Context) error {
return c.NoContent(http.StatusInternalServerError)
}

cache.LastUpdated.WithLabelValues("/smesher/" + smesherId).SetToCurrentTime()

return c.JSON(http.StatusOK, smesher)
}
Loading
Loading