Skip to content

Commit

Permalink
Fix tests, change image name to explorer-stats-api-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kacpersaw committed Aug 6, 2024
1 parent 264760b commit 9c8df8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Docker meta custom api
id: meta_customapi
- name: Docker meta stats api
id: meta_statsapi
uses: docker/metadata-action@v4
with:
images: spacemeshos/explorer-custom-api-dev
images: spacemeshos/explorer-stats-api-dev

- name: Login to DockerHub
uses: docker/login-action@v1
Expand All @@ -117,7 +117,7 @@ jobs:
- uses: docker/build-push-action@v2
with:
context: .
repository: spacemeshos/explorer-custom-api-dev
repository: spacemeshos/explorer-stats-api-dev
file: ./Dockerfile.api
push: true
tags: ${{ steps.meta_customapi.outputs.tags }}
tags: ${{ steps.meta_statsapi.outputs.tags }}
6 changes: 3 additions & 3 deletions Dockerfile.api
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM golang:1.22.3-alpine AS build
WORKDIR /src
COPY . .
RUN apk add --no-cache gcc musl-dev
RUN go build -o explorer-custom-api ./cmd/api/
RUN go build -o explorer-stats-api ./cmd/api/

FROM alpine:3.17
COPY --from=build /src/explorer-custom-api /bin/
COPY --from=build /src/explorer-stats-api /bin/
EXPOSE 5000
EXPOSE 5050
ENTRYPOINT ["/bin/explorer-custom-api"]
ENTRYPOINT ["/bin/explorer-stats-api"]
10 changes: 5 additions & 5 deletions storage/epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ func (s *Storage) computeStatistics(epoch *model.Epoch) {
}
atxs, _ := s.GetActivations(context.Background(), &bson.D{{Key: "targetEpoch", Value: epoch.Number}})
if atxs != nil {
smeshers := make(map[string]int64)
smeshers := make(map[string]uint64)
for _, atx := range atxs {
var commitmentSize int64
var commitmentSize uint64
var smesher string
for _, e := range atx {
if e.Key == "smesher" {
Expand All @@ -389,15 +389,15 @@ func (s *Storage) computeStatistics(epoch *model.Epoch) {
}
if e.Key == "commitmentSize" {
if value, ok := e.Value.(int64); ok {
commitmentSize = value
commitmentSize = uint64(value)
} else if value, ok := e.Value.(int32); ok {
commitmentSize = int64(value)
commitmentSize = uint64(value)
}
}
}
if smesher != "" {
smeshers[smesher] += commitmentSize
epoch.Stats.Current.Security += commitmentSize
epoch.Stats.Current.Security += int64(commitmentSize)
}
}
epoch.Stats.Current.Smeshers = int64(len(smeshers))
Expand Down

0 comments on commit 9c8df8f

Please sign in to comment.